Can't move the forge config files in any subdirectory
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 30
Description
### Pre-flight checklist
- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
### 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_
Contributor guide
Assessment
This issue has not been assessed yet.