electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.49k stars 516 forks source link

Dependency on outcated core-js 2.x core-js/library/web/timers #3445

Open benbucksch opened 10 months ago

benbucksch commented 10 months ago

Pre-flight checklist

Electron Forge version

7.2.0

Electron version

28.0.0

Operating system

Last known working Electron Forge version

7.2.0 (Same)

Expected behavior

Actual behavior

$ yarn start
yarn run v1.22.10
$ electron-forge start
✔ Checking your system
✔ Locating application
✔ Loading configuration
✔ Preparing native dependencies: 6 / 6 [0.4s]
✔ Running generateAssets hook
⠙ [plugin-vite] Launching dev servers for renderer process code
◼ [plugin-vite] Compiling main process code
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
⠙ [plugin-vite] Compiling main process code
vite v4.5.1 building for development...

watching for file changes...
vite v4.5.1 building for development...

watching for file changes...

build started...

build started...
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
⠹ [plugin-vite] Compiling main process code
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
⠙ [plugin-vite] Compiling main process code
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
⠇ [plugin-vite] Compiling main process code
✔ [plugin-vite] Launching dev servers for renderer process code [0.1s]
✔ [plugin-vite] Compiling main process code [6s]

App threw an error during load
Error: Cannot find module 'core-js/library/web/timers'
Require stack:
- ./.vite/build/main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1084:15)
    at n._resolveFilename (node:electron/js2c/browser_init:2:114728)
    at Module._load (node:internal/modules/cjs/loader:929:27)
    at l._load (node:electron/js2c/asar_bundle:2:13642)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/src/mustang/app/electron/.vite/build/main.js:1:274)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'core-js/library/web/timers'
Require stack:
- ./.vite/build/main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1084:15)
    at n._resolveFilename (node:electron/js2c/browser_init:2:114728)
    at Module._load (node:internal/modules/cjs/loader:929:27)
    at l._load (node:electron/js2c/asar_bundle:2:13642)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/src/mustang/app/electron/.vite/build/main.js:1:274)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)

Steps to reproduce

$ yarn install $ yarn start

Not reproducible with a minimal app. Only started happening when I included some older library. It may use some commonjs, in a type: module library, which may trigger this. But I'm just guessing, based on the stack.

Additional information

The file node_modules/core-js/library/web/timers.js does not exist in core-js 3.34.0 nor in 3.0.0. It does exist in core.js 2.6.12.

I have node 18.15.0 installed

Fix

Possible fixes:

ppulseneon commented 2 months ago

Thank you for solution. I would like it to be fixed as soon as possible