You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 20, 2024. It is now read-only.
I have an .mjs file that does import * as icons from "@esri/calcite-ui-icons";
when I run that script I get:
(node:92958) Warning: To load an ES module, set"type": "module"in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/tom/code/opendata-ui/node_modules/@esri/calcite-ui-icons/index.js:2
export {i12X16} from "./js/i12X16.js";
^^^^^^
SyntaxError: Unexpected token 'export'
Note that I also tried running a .js script using const icons = require("@esri/calcite-ui-icons"); but that failed w/ the same syntax error b/c main points to the same ESM file (index.js).
Adding type: "module" to the copy of this library's package.json in my node_modules folder fixes the above error and my script runs fine. However, that will force node consumers to import this module, which may be fine, and in any case is better than the current situation which is that the module cannot be imported nor required. I'm not sure if you're supposed to drop the main entry in that case?
If you have to support both I guess you would need to transpile to CJS and point main to that.