Pre-flight checklist
Electron Forge version
7.2.0
Electron version
v28.1.4
Operating system
MacOs 13.6.3
Last known working Electron Forge version
No response
Expected behavior
Electron should start with no errors and modules should be loaded correctly
Actual behavior
SyntaxError: Cannot use import statement outside a module
Steps to reproduce
I've generated a new project with
npm init electron-app@latest my-new-app -- --template=vite-typescript
The forge.config.ts is located at the root of the project and if I launch the start script at this point everything works.
I want to move the config file into /tools/forge.config.ts, and I do so by also modifying the packages.json:
"config": {
"forge": "./tools/forge.config.ts"
},
Now when I run the start script I get:
SyntaxError: Cannot use import statement outside a module
I've proceeded to also modify the tsconfig.json by adding the tools dir
"include": ["src", "tools"]
but nothing changed.
I've tried dozen of combination of these properties in tsconfig
"target": "ESNext",
"module": "commonjs",
I've also tried other combinations of the module property inside packages.json but still no luck.
It seems things only work if I put back forge.config.ts at the root of the project.
It this a misconfiguration on my side or some of the tools in the projects don't play well if I slightly modify the location of this file?
Additional information
No response
Pre-flight checklist
Electron Forge version
7.2.0
Electron version
v28.1.4
Operating system
MacOs 13.6.3
Last known working Electron Forge version
No response
Expected behavior
Electron should start with no errors and modules should be loaded correctly
Actual behavior
Steps to reproduce
I've generated a new project with
The
forge.config.tsis located at the root of the project and if I launch the start script at this point everything works.I want to move the config file into
/tools/forge.config.ts, and I do so by also modifying the packages.json:Now when I run the start script I get:
I've proceeded to also modify the tsconfig.json by adding the tools dir
but nothing changed.
I've tried dozen of combination of these properties in tsconfig
I've also tried other combinations of the
moduleproperty inside packages.json but still no luck.It seems things only work if I put back
forge.config.tsat the root of the project.It this a misconfiguration on my side or some of the tools in the projects don't play well if I slightly modify the location of this file?
Additional information
No response