【发布时间】:2023-02-26 00:41:22
【问题描述】:
在我使用@electron-forge/plugin-webpack 插件的电子应用程序中。这是我的forge.config.js 文件。
module.exports = {
rebuildConfig: {},
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: '...',
name: '...'
},
}
}
],
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb'
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
// comment the block below inorder to copy the node_modules to the output when packaging
plugins: [
{
name: '@electron-forge/plugin-webpack',
config: {
mainConfig: './webpack.main.config.js',
devContentSecurityPolicy: "connect-src 'self' * 'unsafe-eval'",
renderer: {
config: './webpack.renderer.config.js',
entryPoints: [
{
html: './src/public/home.html',
js: './src/renderer.js',
name: 'main_window',
preload: {
js: './src/preload.js'
},
},
],
},
},
},
],
};
当我运行npm run package时,out/<app>/resources/app/node_modules目录是空的。但是,如果我删除插件部分,则会正确复制 node_modules。但我不能评论插件部分,因为需要 webpack。
我是否配置了任何错误或遗漏了什么?
【问题讨论】:
标签: webpack electron electron-forge