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
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+lowdb@3.0.0\node_modules\lowdb\lib\index.js from E:\js\editor-client\out\main\index.js not supported.
Instead change the require of E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+lowdb@3.0.0\node_modules\lowdb\lib\index.js in E:\js\editor-client\out\main\index.js to a dynamic import() which is available in all CommonJS modules.
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Object. (E:\js\editor-client\out\main\index.js:6:15)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at loadApplicationPackage (E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+electron@20.3.1\node_modules\electron\dist\resources\default_app.asar\main.js:110:16)
at Object. (E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+electron@20.3.1\node_modules\electron\dist\resources\default_app.asar\main.js:222:9)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Object. (node:electron/js2c/browser_init:185:3104)
at ./lib/browser/init.ts (node:electron/js2c/browser_init:185:3308)
at webpack_require (node:electron/js2c/browser_init:1:128)
at node:electron/js2c/browser_init:1:1200
at node:electron/js2c/browser_init:1:1267
at c._load (node:electron/js2c/asar_bundle:5:13343)
As nodejs supports ESM, the community development gradually tends to ESM, which is also the future trend. Some open source projects are also responding to this trend. lowdb has only released esm version since version 3.0. But you need to know that Electron does not support ESM, so the build standard of Electron's main process and preload script is still CJS. So this error occurs (because you externalize it). For modules that support CJS, we'd better externalize it. For modules that only support ESM, we should not externalize it. We should let electron-vite bundle it into a CJS standard module to support Electron.
update to 1.0.11, use externalizeDepsPlugin to automatically externalize dependencies, and exclude lowdb
Describe the bug
Lowdb does not support CommonJS
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+lowdb@3.0.0\node_modules\lowdb\lib\index.js from E:\js\editor-client\out\main\index.js not supported.
Instead change the require of E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+lowdb@3.0.0\node_modules\lowdb\lib\index.js in E:\js\editor-client\out\main\index.js to a dynamic import() which is available in all CommonJS modules.
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Object. (E:\js\editor-client\out\main\index.js:6:15)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at loadApplicationPackage (E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+electron@20.3.1\node_modules\electron\dist\resources\default_app.asar\main.js:110:16)
at Object. (E:\js\editor-client\node_modules.pnpm\registry.npmmirror.com+electron@20.3.1\node_modules\electron\dist\resources\default_app.asar\main.js:222:9)
at c._load (node:electron/js2c/asar_bundle:5:13343)
at Object. (node:electron/js2c/browser_init:185:3104)
at ./lib/browser/init.ts (node:electron/js2c/browser_init:185:3308)
at webpack_require (node:electron/js2c/browser_init:1:128)
at node:electron/js2c/browser_init:1:1200
at node:electron/js2c/browser_init:1:1267
at c._load (node:electron/js2c/asar_bundle:5:13343)
Electron-Vite Version
1.0.9
Electron Version
20.2.0
Vite Version
3.0.9
Validations
The text was updated successfully, but these errors were encountered: