Closed ilyasmez closed 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.
In package.json#L5-L6 the
module
property points to the uncompiled file, which has more priority by Webpack thanmain
(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 likemain
. But if it's needed (I would love to know the reason), we can use thebrowser
property to point to the right file (the compiled one).I want to hear your opinion first, I can open a PR as well.