electron-vite
electron-vite copied to clipboard
rimraf 6.0.1 or electron-store 10.0.0 can't be build correct with bytecodePlugin
Describe the bug
pnpm create @quick-start/electron testrimraf --template vue ✔ Add TypeScript? … Yes ✔ Add Electron updater plugin? … Yes ✔ Enable Electron download mirror proxy? … Yes add these lines in main/index.ts bottom
import { rimrafSync } from 'rimraf';
import { mkdirSync } from 'fs';
mkdirSync('aaa', {recursive: true});
rimrafSync('aaa');
rimraf 6.0.1
latest
plugins: [externalizeDepsPlugin(),bytecodePlugin()]
it will show when running the exe Uncaught Exception: TypeError: Class extends value undefined is not a constructor or null at Object.<anonymous> (/Users/xxx/code/projects/app/testrimraf/dist/mac-arm64/testrimraf.app/Contents/Resources/app.asar/node_modules/path-scurry/dist/commonjs/index.js:124:40)
and if using
plugins: [externalizeDepsPlugin({exclude:['rimraf']}),bytecodePlugin()]
it will show when pnpm run build [vite:bytecode] unknown file: Unable to transform arrow inside class property
and it's working for run dev
pnpm create @quick-start/electron testelectronstore --template vue ✔ Add TypeScript? … Yes ✔ Add Electron updater plugin? … Yes ✔ Enable Electron download mirror proxy? … Yes add these lines in main/index.ts bottom
import Store from 'electron-store';
const store = new Store();
electron-store 10.0.0
latest
plugins: [externalizeDepsPlugin(),bytecodePlugin()]
it will show when running the exe or run dev Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/xxx/code/projects/app/testelectronstore/node_modules/.pnpm/[email protected]/node_modules/electron-store/index.js from /Users/xxx/code/projects/app/testelectronstore/out/main/index.js not supported.
and my project can't using type:module for other codes, here just for the demo case.
but if using
plugins: [externalizeDepsPlugin({exclude:['electron-store']}),bytecodePlugin()]
it will show when pnpm run build [vite:bytecode] unknown file: Unable to transform arrow inside class property
Electron-Vite Version
2.3.0
Electron Version
31.0.2
Vite Version
5.3.1
Validations
- [X] Follow the Code of Conduct.
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.