Open
Description
This package is made as an ESM module.
However, it is possible to use ESM modules in a CJS environment by using dynamic imports.
But when I tried to import this package with a dynamic import I got this error:
Module not found: Error: Package path . is not exported from package /web/workspace/node_modules/@material/material-color-utilities (see exports field in /web/workspace/node_modules/@material/material-color-utilities/package.json)
This is because "require" (what CJS environments look for) is not listed in the exports of package.json (currently there's only "types" and "import").
I suggest to add "require" to the "exports" field in package.json so this library can work in CJS environments for those that are not quite ready to switch everything over to ESM yet.
package.json
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require" : "./index.js"
}
},
With that in place it runs perfectly on node.js and in the browser in my CJS setup. I'm getting color schemes etc.