Closed tornadocontrib closed 5 months ago
The "module"
field of package.json
is meant for backwards compatibility; modern bundlers and Node.js should pick up on the "exports"
field instead (which is properly configured for Node.js). I believe there is a way to configure Rollup to have this behavior via the node-resolve
plugin.
@101arrowz Yes I ended up using webpack with the following, seriously rollup should improve their deps resolving system
resolve: {
alias: {
'fflate': 'fflate/node'
},
},
The modules field would only resolve to browser builds when using bundlers like rollup.js. I think the workaround would be building a file that could resolve to both environment or we could simply use node.js exports only and let the browser bundlers like webpack or other would resolve it for browsers.