Open xuya227939 opened 3 hours ago
What node version do you use?
node -v v20.14.0
@cawa-93
and macOS Version is 15.0.1 @cawa-93
Does it work on node v23 ?
it's work, but why? @cawa-93
That's because I tested it only on node v23 and did not realize I use experimental feature. In your case, you can simply rewrite electron-builder.mjs
into electron-builder.cjs
(and rewrite content from ES modules CommonJS modules). And it should work on node v20
Describe the bug
npm run compile
error
⨯ Unable to
requiremoduleName=/Users/jiang/Desktop/vite-electron-builder-main/electron-builder.mjs message=require() of ES Module /Users/jiang/Desktop/vite-electron-builder-main/electron-builder.mjs not supported. Instead change the require of /Users/jiang/Desktop/vite-electron-builder-main/electron-builder.mjs to a dynamic import() which is available in all CommonJS modules.
To Reproduce