Migrate to named exports and provide node esm support#241
Conversation
In this diff I added new entry point to compile es modules with named exports to solve this problem (json5#240). It's a breaking change so we can drop legacy node support (newer versions of rollup and many other tools requires this) and add native node es modules support.
|
Thank you for this PR, but I think it adds too much complexity compared to #243. Instead of one entry point ( There is also a You've also removed the |
|
esm.js is used only for building proper exports in dist/index.mjs because generating exports from commonjs is not reliable and may change with rollup upgrade. I do not suggest to remove dist/index.mjs. "module" is bundler specific field. "exports" is node specific way to support es modules natively. Probably only webpack 5 support both them yet. Here's example "browser" field should not just point to umd. Bundlers prefer "browser" field over over "module" when specified as a string. This makes "module" field useless in this case. See the correct use case for "browser" field https://github.com/visgl/react-map-gl/blob/master/package.json#L17-L25 |
In this diff I added new entry point to compile es modules with named
exports to solve this problem (#240).
It's a breaking change so we can drop legacy node support (newer
versions of rollup and many other tools requires this) and add native
node es modules support.