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
I agree to follow the code of conduct that this project uses.
I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.6.0
Electron version
v34.0.0
Operating system
Windows 10 (22H2)
Last known working Electron Forge version
Unknown
Expected behavior
After creating a new app using the default template, running npm start should start the app, with no errors thrown
Actual behavior
The application throws the following exception in a dialog and the console:
Cannot use import statement outside a module
Steps to reproduce
Create a new application using npx create-electron-app@latest my-app
Navigate to the new app's folder
Run npm start
Additional information
Node version: v12.13.0 LTS
Screenshot of the error dialog:
Console output when the error is thrown:
(node:13940) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `electron --trace-warnings ...` to show where the warning was created)
App threw an error during load
C:\Users\pauli\Desktop\my-app\src\index.js:1
import { app, BrowserWindow } from 'electron';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1385:20)
at Module._compile (node:internal/modules/cjs/loader:1435:41)
at Module._extensions..js (node:internal/modules/cjs/loader:1564:10)
at Module.load (node:internal/modules/cjs/loader:1295:32)
at Module._load (node:internal/modules/cjs/loader:1111:12)
at c._load (node:electron/js2c/node_init:2:16955)
at cjsLoader (node:internal/modules/esm/translators:350:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:286:7)
at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
The text was updated successfully, but these errors were encountered:
It seems like the template was updated to use imports instead of requires in the following commit: f947936.
Changing those back to require fixes the issue. This issue doesn't seem to happen with the Webpack template.
Pre-flight checklist
Electron Forge version
7.6.0
Electron version
v34.0.0
Operating system
Windows 10 (22H2)
Last known working Electron Forge version
Unknown
Expected behavior
After creating a new app using the default template, running
npm start
should start the app, with no errors thrownActual behavior
The application throws the following exception in a dialog and the console:
Steps to reproduce
npx create-electron-app@latest my-app
npm start
Additional information
Node version: v12.13.0 LTS
Screenshot of the error dialog:
Console output when the error is thrown:
The text was updated successfully, but these errors were encountered: