Skip to content
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

Support ESM forge.config.js #3350

Closed
3 tasks done
mahnunchik opened this issue Sep 14, 2023 · 2 comments · Fixed by #3358
Closed
3 tasks done

Support ESM forge.config.js #3350

mahnunchik opened this issue Sep 14, 2023 · 2 comments · Fixed by #3358

Comments

@mahnunchik
Copy link
Contributor

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem description

As ESM will lended in electron 28 electron/electron#37535 (comment) so it is useful to have ESM support in forge.config.js

Proposed solution

ESM support ;)

Alternatives considered

I don't know any reason to not support ESM

Additional information

No response

@mahnunchik
Copy link
Contributor Author

Error [ERR_REQUIRE_ESM]: require() of ES Module /test-electron/forge.config.js from /test-electron/node_modules/@electron-forge/core/dist/util/forge-config.js not supported.
Instead change the require of forge.config.js in /test-electron/node_modules/@electron-forge/core/dist/util/forge-config.js to a dynamic import() which is available in all CommonJS modules.

According to the error message adding the ESM support should be pretty easy.

@mahnunchik
Copy link
Contributor Author

mahnunchik commented Sep 18, 2023

Monkey patch of this file makes ESM config works!

const loaded = await import(path_1.default.resolve(dir, forgeConfig));

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants