-
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
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: code: 'ERR_REQUIRE_ESM' #900
Comments
I'm having a similar problem with electron. |
@borkdude, I couldn't still solve this problem. So I just went with the traditional approach, like this: https://github.com/maifeeulasad/WhatApp/blob/main/index.js And everything is working fine now. Although my plan to use a 100% es6 based electron project is still a dream. |
@maifeeulasad I developed a library to interpret ClojureScript code from files or strings: https://github.com/borkdude/nbb/blob/main/test-scripts/api-test/test.mjs The library is offered as an ES Module. I would like to use this library from Electron, but so far I didn't succeed. |
@borkdude Here is a really interesting article: https://blog.bitsrc.io/javascript-require-vs-import-47827a361b77 And here is a of answer, which you may also find helpful: https://stackoverflow.com/a/63942979/10305444 |
@maifeeulasad I don't see an example of how to use an ES module from an Electron app, but perhaps I'm missing something. |
The full error looks like this, on running ``:
My node version is : v14.17.0
Here is my index.js :
Here is the main.js :
The scripts I'm also using are:
Although it starts and builds, but I get error when trying to run those built files.
The text was updated successfully, but these errors were encountered: