Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the Common JS version of the module work? #95

Closed
watson opened this issue Jul 27, 2021 · 1 comment
Closed

Does the Common JS version of the module work? #95

watson opened this issue Jul 27, 2021 · 1 comment

Comments

@watson
Copy link

watson commented Jul 27, 2021

This modules ships with a Common JS version under a dist directory:

image

However, the exports field in package.json, is defined as such:

d3-color/package.json

Lines 35 to 38 in 7d61bbe

"exports": {
"umd": "./dist/d3-color.min.js",
"default": "./src/index.js"
},

As far as I can see, these two entries doesn't really make any sense. E.g. there's no way that I know of to require the umd version of this package. Either the exports keys should all be prefixed with ./ which would require users to to update their require and import statements accordingly, or the two keys should be require and import instead of umd and default. In both cases the ./dist/d3-color.min.js key should be ./dist/d3-color.min.cjs (notice the cjs ending) since this is a package of "type": "module".

@mbostock
Copy link
Member

CommonJS is no longer supported as of d3-color 3.0. In Node (or other environments that use package.json), you must use the ES module import. The UMD is intended for browsers, typically as either a vanilla script or AMD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants