I'm looking for some help with package.json entry points (i.e. with @rollup/plugin-node-resolve
, with snowpack). For a package I'm importing (indirectly via RxDB), I'm having some issues and according to its maintainer, it's just not choosing the correct entry point:
the broadcast-channel module is a esm module that has a different export index for browsers. You bundler should not include the methods/node.js file with the promisify call
The entry point in question:
https://github.com/pubkey/broadcast-channel/blob/master/package.json#L11
The exports section from package.json
^ looks like this -- my understanding is that if I can get rollup to choose the entries under "browser"
then that would solve my problem:
"exports": {
".": {
"node": {
"import": "./dist/esnode/index.js",
"default": "./dist/es5node/index.js"
},
"browser": {
"import": "./dist/esbrowser/index.js",
"default": "./dist/lib/index.es5.js"
}
},
"./package.json": "./package.json"
},
I've tried the following options but it has not helped:
nodeResolve({
browser: true,
mainFields: ['browser'],
exportConditions: ['browser'],
})
Can anyone recommend some alternative config options to try?
Additional info, in case it helps: the same issue comes up when I use @snowpack/plugin-webpack