shrpne / vue-inline-svg

Dynamically loads an SVG source and inline <svg> element so you can manipulate the style of it
MIT License
177 stars 22 forks source link

The module property in package.json points to the uncompiled file #14

Closed ilyasmez closed 4 years ago

ilyasmez commented 4 years ago

In package.json#L5-L6 the module property points to the uncompiled file, which has more priority by Webpack than main (check resolve.mainFields). And this makes the component throw syntax errors on older browsers.

If there is no good reason for having it, I think it would make sense to remove the module property or make it point to the compiled file, just like main. But if it's needed (I would love to know the reason), we can use the browser property to point to the right file (the compiled one).

I want to hear your opinion first, I can open a PR as well.

shrpne commented 4 years ago

The reason for using sources as module target was this: if someone uses module field then it uses Webpack or some other bundler, then they can configure Webpack to prepare these sources in best way. E.g. transpile them for browsers they actually use.

But I agree that users should be able to use this package without extra configuration by default. I think browser field pointing to the compiled file should work well.