Open rtritto opened 2 weeks ago
@jdms754 what do you think about this issue?
@jdms754 what do you think about this issue?
I added import.meta.resolve('electron-squirrel-startup/package.json')
anywhere in https://github.com/jdms754/forge-vite-bundler/blob/main/src/main.ts and was able to npm run start
. I am on macOS Sonoma 14.5, but I am not sure that is the cause of the difference.
I've already tried with import.meta.resolve('electron-squirrel-startup/package.json')
(issue description).
Maybe it's related to some settings in tsconfig.json
:
I've already tried with
import.meta.resolve('electron-squirrel-startup/package.json')
(issue description). Maybe it's related to some settings intsconfig.json
:
Yes, looks like it's tsconfig.json
. Why not set moduleResolution
to node16
or bundler
? You will also need to update module
in the same file and you may have to make additional changes to your vite config files.
I used the template created by @caoxiemeihao
Pre-flight checklist
Electron Forge version
7.4.0
Electron version
31.0.1
Operating system
Windows 11
Last known working Electron Forge version
No response
Expected behavior
No error in console
Actual behavior
With ESM, the
electron-squirrel-startup dependency
can't be found if it's in dependencies (it works if I move it into devDependencies):require.resolve
(Node < 20.6.0) example;src/main.ts
file:Console output:
import.meta.resolve
(Node.js >= 20.6.0) example;src/main.ts
file:Console output:
Note: I did a try with other dependencies such as react and solid-js and I got same issue.
Steps to reproduce
Repository: https://github.com/rtritto/template-electron-vite
Steps:
git clone https://github.com/rtritto/template-electron-vite.git
cd template-electron-vite
yarn
yarn start
Additional information
No response