Failed to load module
Problem
Webpack will read browser field and ignoring main and module entry. And because of the bundle of "browser" version is using iife format, module script doesn't able to resolve the module correctly.
import { StickyObserver } from '@welt/sticky-observer';
console.log(StickyObserver); // undefined
Expected behavior
Should only use the main CJS field if available, or even module, literally everything but the browser one.
Reference
webpack/webpack#7646
This issue happened in v1.1.0, and caused by #8.
If downgrade to v1.0.0, module can be resolved correctly.
Yes I had the same issue. You can workaround it with the this webpack config: https://webpack.js.org/configuration/resolve/#resolvemainfields
I use mainFields: ['module', 'main']. For the future I consider to remove the UMD bundle & browser field