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 has been 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.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have an .mjs file that does
import * as icons from "@esri/calcite-ui-icons";
when I run that script I get:
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/cmain
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 toimport
this module, which may be fine, and in any case is better than the current situation which is that the module cannot beimport
ed norrequire
d. I'm not sure if you're supposed to drop themain
entry in that case?If you have to support both I guess you would need to transpile to CJS and point
main
to that.The text was updated successfully, but these errors were encountered: