-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERR_REQUIRE_ESM: The simplest fix! #897
Comments
Didn't work for me; not sure why. I installed the modified esm package using Yarn 2: (note that the instructions in your readme don't work for Yarn 2; I had to add
I added this as my launch script:
However, when I run that script, it still gives the same error as the regular
If I find further info, I'll post it here. |
Oh, it looks like Node 14.13.0+ supports named imports from common-js modules!: https://simonplend.com/node-js-now-supports-named-imports-from-commonjs-modules-but-what-does-that-mean Well, some of them anyway. (the blog post linked shows how it only works for some packages -- ones where cjs-module-lexer is able to detect the export names through static analysis) There may not be a need for these sorts of workarounds soon then. (I'll have to see, after using Node 14.13.0+ for a while) |
@michaelfig Thanks for the simple fix. I also found out that the fix itself is not enough, at least for my case. I have to override the /** package.json */
{
...
"esm": {
"cjs": true,
"mode": "all"
}
} |
@michaelfig any plans to release your fix to npm or get this merged into esm? It's providing exactly what I wanted: Authoring ESM modules by default with |
Doesn't seem so. I think this upstream Also, instead of putting on NPM (where it would need to have a different name), just follow the instructions at the top of the readme linked in the description to install from Github.
My pleasure! |
@michaelfig |
Sorry, I don't need this package anymore as Agoric has completed its migration off of it, and other priorities beckon. I hate to contribute to more abandonware, but here I am. |
Ok then. Could you explain that in your README then? Thanks! |
@mashpie or anyone else who'd prefer to install it from npm rather than GitHub: https://www.npmjs.com/package/agoric-labs-esm-built-pmb |
The simplest way I could find to fix #868 was to publish a fork.
Please take a look at https://github.com/agoric-labs/esm/tree/Agoric#readme
The text was updated successfully, but these errors were encountered: