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

npm run dev没有问题;npm run build:win时报以下错误;该怎么解决 #546

Closed chunnuanchuankai closed 4 months ago

chunnuanchuankai commented 5 months ago

Describe the bug

node_modules/mars3d/dist/mars3d.js (12:7): Error when using sourcemap for reporting an error: Can't resolve original location of error. ✓ 4546 modules transformed. x Build failed in 14.52s error during build: node_modules/mars3d/dist/mars3d.js (12:7): "default" is not exported by "mars3d-cesium?commonjs-external", imported by "node_modules/mars3d/dist/mars3d.js". file: E:/electronSpace/bud3d-scene-app/node_modules/mars3d/dist/mars3d.js:12:7

10: import { __module as mars3dModule } from "\u0000E:/electronSpace/bud3d-scene-app/node_modules/mars3d/dist/mars3d.js?c... 11: var mars3d = mars3dModule.exports; 12: import require$$0 from "\u0000mars3d-cesium?commonjs-external"; ^ 13: import { __require as require$$1 } from "\u0000E:/electronSpace/bud3d-scene-app/node_modules/@turf/turf/dist/js/index...

at getRollupError (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
at error (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
at Module.error (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13858:16)
at Module.traceVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:14306:29)
at ModuleScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:11984:39)
at ChildScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at FunctionScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at FunctionBodyScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at ChildScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)
at FunctionScope.findVariable (file:///E:/electronSpace/bud3d-scene-app/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7432:38)

Electron-Vite Version

^2.0.0

Electron Version

^28.2.0

Vite Version

5.3.1

Validations

alex8088 commented 5 months ago

将相关模块安装到deps,https://cn.electron-vite.org/guide/dev#dependencies-vs-devdependencies

chunnuanchuankai commented 4 months ago

图片 已经放到了deps里; 应该是安全策略的问题;外部资源服务,访问cors,有没有跨域的解决方案