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
Hi, I'm trying to upgrade our existing electron codebase (frontend codebase is separate) to use electron-vite/vite.
Can I use electron-vite just for main and preload files? Frontend is in separate repo and while development electron just loads localhost:3000. That is where the frontend development is running and handled by webpack. During build frontend files are copied as part of electron-builder config.
I have already started experimenting with electron-vite and I'm stuck on having issue with fsevents.
yarn run v1.22.19
$ electron-vite dev
renderer config is missing
vite v4.4.9 building for development...
✓ 1197 modules transformed.
✓ built in 1.67s
[vite:node-asset] Could not load /Users/hackal/WebstormProjects/acreom/electron/node_modules/fsevents/fsevents.node?commonjs-proxy (imported by node_modules/fsevents/fsevents.js): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/Users/hackal/WebstormProjects/acreom/electron/node_modules/fsevents/fsevents.node'
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
TypeError [PLUGIN_ERROR]: Could not load /Users/hackal/WebstormProjects/acreom/electron/node_modules/fsevents/fsevents.node?commonjs-proxy (imported by node_modules/fsevents/fsevents.js): The argument 'path' must be a string or Uint8Array without null bytes. Received '\x00/Users/hackal/WebstormProjects/acreom/electron/node_modules/fsevents/fsevents.node'
at open (node:internal/fs/promises:538:10)
at Object.readFile (node:internal/fs/promises:909:20)
at Object.load (/Users/hackal/WebstormProjects/acreom/electron/node_modules/electron-vite/dist/chunks/lib-a7bfaa24.js:550:47)
at file:///Users/hackal/WebstormProjects/acreom/electron/node_modules/rollup/dist/es/shared/node-entry.js:25419:40
at async PluginDriver.hookFirstAndGetPlugin (file:///Users/hackal/WebstormProjects/acreom/electron/node_modules/rollup/dist/es/shared/node-entry.js:25319:28)
at async file:///Users/hackal/WebstormProjects/acreom/electron/node_modules/rollup/dist/es/shared/node-entry.js:24487:75
at async Queue.work (file:///Users/hackal/WebstormProjects/acreom/electron/node_modules/rollup/dist/es/shared/node-entry.js:25529:32) {
code: 'PLUGIN_ERROR',
pluginCode: 'ERR_INVALID_ARG_VALUE',
plugin: 'vite:node-asset',
hook: 'load',
Seems like vite can not handle binary files (.node) properly.
Thanks, that helped with the warnings and the issue with fsevents.
However now, when I start the script it says that it can not find electron module
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Cannot find module '/Users/hackal/WebstormProjects/acreom/electron/out/node_modules/electron'
Require stack:
- /Users/hackal/WebstormProjects/acreom/electron/out/main/main.js
- /Users/hackal/WebstormProjects/acreom/electron/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
at n._resolveFilename (node:electron/js2c/browser_init:2:117457)
at Module._load (node:internal/modules/cjs/loader:927:27)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1148:19)
at require (node:internal/modules/cjs/helpers:110:18)
at createMainWindow (/Users/hackal/WebstormProjects/acreom/electron/out/main/main.js:458:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[8684:0810/151913.361760:ERROR:CONSOLE(2)] "Electron sandboxed_renderer.bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (2)
[8684:0810/151913.361786:ERROR:CONSOLE(2)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (2)
Fixed the issue. It was trying to include electron from node_modules in electron/out folder, however they are in electron. Fixed it by specifying --outDir.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm trying to upgrade our existing electron codebase (frontend codebase is separate) to use electron-vite/vite.
Can I use electron-vite just for main and preload files? Frontend is in separate repo and while development electron just loads localhost:3000. That is where the frontend development is running and handled by webpack. During build frontend files are copied as part of electron-builder config.
I have already started experimenting with electron-vite and I'm stuck on having issue with fsevents.
Seems like vite can not handle binary files (
.node
) properly.This is my electron.vite.config.js
Thanks for help
Beta Was this translation helpful? Give feedback.
All reactions