'Webpack uses two different imports for same package
I have a package, that Webpack sometimes requires from './node_modules/PACKAGE/index.js' and other times it uses './node_modules/PACKAGE/dist/index.mjs' and I have no clue how to solve it, so that it always uses the same file. The package has internal state, so now instead of having one consistent state it has two states and of course things won't work properly.
If I manually delete the './node_modules/PACKAGE/dist/index.mjs', everything works perfectly.
One option I can think of, would be to always prefer .js files for importing, but I don't know how to do it or if there are better options. I feel like this might be solvable with proper webpack configs.
Update:
I realized, I have included the PACKAGE in question to Babel transpilation, because it wasn't IE11 compatible by default. So perhaps that could affect this behavior?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
