-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 #15
Comments
Fixed by deleting |
The makers I offer now there are made for ESM, not CJS. Your config has to be ".mts", else Forge will load stuff as CJS… |
Also my stance why I dropped ESM without introducing CJS was put there: #14. TL;DR: ESM is at this point supported everywhere (when I started as a web dev, this wasn't really the case and ESM was really problematic with TypeScript and Electron), and since it is Forge that handles module imports, going with ESM-only makers is the right direction for the present/future scenarios. For other reasons, I'd say having async module loading is another great thing to have, and it fits well the design of the makers themselves. |
I hear you, and I don't disagree, ESM is definitely the way to go. I'm just unsure what to do to make it work.
|
You may check the example on this project, although I think I've built config (AFAIK Forge might need some optdep for TS imports that I didn't install), it seemed to work fine for me at the time of creating this. |
As of the said PR, Forge's already merged a good enough support for ESM here: 🎉 Hope to see it in action! |
Running forge 7.5.0 with either the ts, mts or cts extension on the config file still causes errors. Using the .mts extension continues to cause the |
@coredev-uk I think that's the problem of the dependency Forge uses, it might defaults to |
That being said, standard forge.config.js or non-class loading (i.e. |
Yeah that worked, its such a strange thing how and where ESM works properly and does not. Previously I was running I'll switch back later to the other method to try and get some logs for you, but I'd imagine its on Forge's end. |
Now with Node's latest changes to |
Hi! Trying to add this to a project that is very nearly the default Electron Forge export and getting ES module errors.
Repro case is here. I'm not sure why it thinks it's a ES module and none of the rest are. Pretty weird.
The text was updated successfully, but these errors were encountered: