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
The app was created with electron forge's vite / typescript template. However, when I go to import this plugin, I get the following error:
An unhandled rejection has occurred inside Forge:
Error: Build failed with 1 error:
node_modules/@electron-forge/plugin-vite/node_modules/esbuild/lib/main.js:1373:27: ERROR: [plugin: externalize-deps] Failed to resolve "@sveltejs/vite-plugin-svelte". This package is ESM only but it was tried to load by `require`. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.
at failureErrorWithLog (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1649:15)
at D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1058:25
at runOnEndCallbacks (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1484:45)
at buildResponseToResult (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1056:7)
at D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1085:16
at responseCallbacks.<computed> (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:703:9)
at handleIncomingPacket (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:762:9)
at Socket.readFromStdout (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:679:7)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:545:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:495:3)
at Socket.Readable.push (node:internal/streams/readable:375:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
An unhandled rejection has occurred inside Forge:
Error: Build failed with 1 error:
node_modules/@electron-forge/plugin-vite/node_modules/esbuild/lib/main.js:1373:27: ERROR: [plugin: externalize-deps] Failed to resolve "@sveltejs/vite-plugin-svelte". This package is ESM only but it was tried to load by `require`. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.
at failureErrorWithLog (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1649:15)
at D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1058:25
at runOnEndCallbacks (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1484:45)
at buildResponseToResult (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1056:7)
at D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:1085:16
at responseCallbacks.<computed> (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:703:9)
at handleIncomingPacket (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:762:9)
at Socket.readFromStdout (D:\Work\forge\TMP\GameScript\node_modules\@electron-forge\plugin-vite\node_modules\esbuild\lib\main.js:679:7)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:545:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:495:3)
at Socket.Readable.push (node:internal/streams/readable:375:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
System Info
PS D:\Work\forge\TMP\GameScript> npx envinfo --system --binaries --browsers --npmPackages "{svelte,svelte-hmr,@sveltejs/*,vite}"
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\emful\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\emful\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: C:\Users\emful\AppData\Local\npm-cache\_logs\2024-01-11T22_45_02_074Z-debug-0.log
The text was updated successfully, but these errors were encountered:
As the error indicates, this package is published only as ESM. I don't know how @electron-forge/plugin-vite is attempting to load vite-plugin-svelte, but if it's trying to require() it like the error message indicates, then that's not going to work, and that other plugin will need to do something different.
A quick search on its issue tracker reveals electron/forge#3439 which may be relevant.
Describe the bug
Here's my vite.renderer.config.ts file:
The app was created with electron forge's vite / typescript template. However, when I go to import this plugin, I get the following error:
Reproduction URL
https://github.com/Sahasrara/vite-plugin-svelte-electron-repro/tree/main/GameScript
Reproduction
Checkout the repo and run
npm start
Logs
System Info
The text was updated successfully, but these errors were encountered: