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
When I compile rescript into JavaScript and have Node.js run it, I found that the @rescript/corewas not set as a esmodule. When I manually changed the package.json in the core to type: module, everything worked properly.
(node:46659) 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/projects/rescript-message/node_modules/.pnpm/@[email protected][email protected]/node_modules/@rescript/core/src/Core__List.res.js:3
import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
The text was updated successfully, but these errors were encountered:
You need to set the file extension to .mjs or .res.mjs to opt into ESM for dependent packages. If we were to set "type": "module" in the package.json for Core it would mean ESM would be the default and for CJS support you would need to set the file extension to .cjs. Opting into ESM is probably the best path now, but the docs could probably be clearer around this. Soon this library will be part of the compiler, so it will be easier to keep everything aligned with ESM/CJS.
When I compile rescript into JavaScript and have Node.js run it, I found that the
@rescript/core
was not set as a esmodule. When I manually changed thepackage.json
in thecore
totype: module
, everything worked properly.The text was updated successfully, but these errors were encountered: