Closed watson closed 2 years ago
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.
This modules ships with a Common JS version under a
dist
directory:However, the
exports
field inpackage.json
, is defined as such:https://github.com/d3/d3-color/blob/7d61bbe6e426a7f3d3f4520a8b31cfc92dc69ee7/package.json#L35-L38
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 theexports
keys should all be prefixed with./
which would require users to to update theirrequire
andimport
statements accordingly, or the two keys should berequire
andimport
instead ofumd
anddefault
. In both cases the./dist/d3-color.min.js
key should be./dist/d3-color.min.cjs
(notice thecjs
ending) since this is a package of"type": "module"
.