alex8088 / electron-vite

Next generation Electron build tooling based on Vite 新一代 Electron 开发构建工具,支持源代码保护
https://electron-vite.org
MIT License
3.57k stars 153 forks source link

electron-vite从1.0.29升级到2.3.0之后,启动electron-vite dev后会出现无法找到和导入electron-log #601

Closed 24Hoursss closed 2 months ago

24Hoursss commented 3 months ago

Describe the bug

App threw an error during load Error: Cannot find module 'electron-log/src/main/transforms/object' Require stack:

C:\Users\PC\Desktop\project\out\main\index.js C:\Users\PC\Desktop\project\node_modules\electron\dist\resources\default_app.asar\main.js C:\Users\PC\Desktop\project\out\main\index.js C:\Users\PC\Desktop\project\node_modules\electron\dist\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:117760) at Module._load (node:internal/modules/cjs/loader:927:27) at f._load (node:electron/js2c/asar_bundle:2:13377) at Module.require (node:internal/modules/cjs/loader:1148:19) at require (node:internal/modules/cjs/helpers:110:18) at Module. (C:\Users\PC\Desktop\project\out\main\index.js:14:16) at Module._compile (node:internal/modules/cjs/loader:1269:14) at Module._extensions..js (node:internal/modules/cjs/loader:1324:10) at Module.load (node:internal/modules/cjs/loader:1124:32)

报错出现在:C:\Users\PC\Desktop\project\out\main\index.js:14:16即以下代码 const object = require("electron-log/src/main/transforms/object");

Electron-Vite Version

2.3.0

Electron Version

25.6.0

Vite Version

4.4.9

Validations

alex8088 commented 3 months ago

安装模块到dep中