tomshanley / d3-sankey-circular

A fork of the d3-sankey library to allow circular links.
MIT License
89 stars 41 forks source link

Don't use mjs for module dist yet #33

Closed peteruithoven closed 5 years ago

peteruithoven commented 5 years ago

See: #32

This is the easiest solution to fix issues with default config of Webpack. Background:

Files ending with .mjs are parsed as javascript/esm, a stricter mode. This mode does not allow to import CJS modules like ESM ones.

While this issue looks like a webpack one, it is not: react-apollo should correctly import non-ESM dependencies, in this case react.

From: https://github.com/apollographql/react-apollo/issues/1737

Just remember Webpack's defaults are the way they are for a reason. .mjs is limited because it's not fully baked and it's support story isn't finished yet. If you need javascript/auto you should really be using .js.

From: https://github.com/apollographql/react-apollo/issues/1737#issuecomment-373039056

I think this is a better solution than having people customize their webpack config, especially since webpack's is trying to be zero config and people using tools like create-react-app, vue-cli who might not even realize that they are using webpack.

Ideally d3-array, d3-collection, and d3-shape start including a es format es well, but that will take time.

peteruithoven commented 5 years ago

Thanks @tomshanley!

tomshanley commented 5 years ago

I'll update npm later on this evening