101arrowz / fflate

High performance (de)compression in an 8kB package

Home Page:https://101arrowz.github.io/fflate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect modules field for node.js

tornadocontrib opened this issue · comments

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.

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'
      },
    },