Open sjmik opened 5 years ago
Thanks for the report.
Removing the module
field from the package.json
would likely fix it, but then I wouldn't be exposing the module anymore, which I want to do.
I'll have to dig around a little to see if there's some good way to handle it, and fix it if possible or at least document it.
That issue I read suggested you might be able to add a browser
field. But idk... I couldn't even find module
in the npm docs.
Did you see this workaround in the comments for that issue?
resolve: { mainFields: ["main", "module"] }
Since you don't want any modules
in your bundle it seems logical.
Heh, I didn't bother looking into it because the import
change worked.
Anyway, any one of these changes independently fix my issue:
import merge from 'mergerino'
to import merge from 'mergerino/dist/mergerino.es5'
resolve: { mainFields: ['browser', 'main', 'module'] }
to webpack.config.js
"browser": "dist/mergerino.es5.min.js"
to node_modules\mergerino\package.json
Looks like the webpack default is resolve: { mainFields: ['browser', 'module', 'main'] }
(from https://webpack.js.org/configuration/resolve/#resolve-mainfields)
Feel free to close this if you think it's not worth changing.
Hey, I don't know much about authoring node modules, so I'm not sure if there is anything you can do about this. I'm using webpack to run my code through babel to get IE11 support. I have it configured to only babelfy my source code, not node_modules.
If I import mergerino like
import merge from 'mergerino';
webpack will pick up the ES6 version. I can workaround it by instead doingimport merge from 'mergerino/dist/mergerino.es5';
.https://github.com/webpack/webpack/issues/5756