Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite-electron-vue3-ts项目,本地使用正常,打包后报错 #231

Open
zhouqunfang opened this issue Oct 31, 2023 · 9 comments
Open

Comments

@zhouqunfang
Copy link

image

@zhouqunfang
Copy link
Author

const Screenshots = require('electron-screenshots') 这样引入的

@zhouqunfang
Copy link
Author

image
我有加配置,但是还是会报这个错误

@nashaofu
Copy link
Owner

nashaofu commented Nov 1, 2023

应该是打包后node_modules下不存在相关依赖把,你查看一下app.asar文件吧

@gusye1234
Copy link

我也遇到了这个问题, 我是通过electron react boilplate那个项目初始化的. 也是打包的时候没问题, 运行的时候会报错, 说找不到module, 而且是报错找不到的module都是electron-screenshots的依赖module, debug, fs-extra这些的...

@zhouqunfang
Copy link
Author

zhouqunfang commented Nov 29, 2023 via email

@gusye1234
Copy link

我也遇到了这个问题, 我是通过electron react boilplate那个项目初始化的. 也是打包的时候没问题, 运行的时候会报错, 说找不到module, 而且是报错找不到的module都是electron-screenshots的依赖module, debug, fs-extra这些的..

这个问题解决了, 我用的electron react boilplate但是用的pnpm作为包管理器, 所以造成了依赖的问题, 换成npm就正常了

@DZwangbing
Copy link

这个问题解决了, 我用的electron react boilplate但是用的pnpm作为包管理器, 所以造成了依赖的问题, 换成npm就正常了

您好,请教一下,我也用的electron react boilplate 使用的 npm,在main.prod配置了externals: {'electron-screenshots': "require('electron-screenshots')"},但是打包后仍提示Cannot find module 'require('electron-screenshots')'报错

@zhouqunfang
Copy link
Author

zhouqunfang commented Sep 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants