Skip to content

Commit f7d9fc3

Browse files
committed
allow custom background entrypoint
1 parent 6c10f4f commit f7d9fc3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = (api, options) => {
77
? options.pluginOptions.electronBuilder
88
: {}
99
const outputDir = pluginOptions.outputDir || 'dist_electron'
10+
const backgroundFile = pluginOptions.backgroundFile || 'src/background.js'
1011
api.registerCommand(
1112
'build:electron',
1213
{
@@ -52,7 +53,7 @@ module.exports = (api, options) => {
5253
mainConfig
5354
.plugin('env')
5455
.use(webpack.EnvironmentPlugin, [{ NODE_ENV: 'production' }])
55-
mainConfig.entry('background').add(api.resolve('./src/background.js'))
56+
mainConfig.entry('background').add(api.resolve(backgroundFile))
5657

5758
console.log('Bundling render process:')
5859
rendererConfig.target('electron-renderer').output.publicPath('./')
@@ -142,7 +143,7 @@ module.exports = (api, options) => {
142143
mainConfig
143144
.plugin('env')
144145
.use(webpack.EnvironmentPlugin, [{ NODE_ENV: 'development' }])
145-
mainConfig.entry('background').add(api.resolve('./src/background.js'))
146+
mainConfig.entry('background').add(api.resolve(backgroundFile))
146147
const bundle = webpack(mainConfig.toConfig())
147148

148149
console.log('Bundling main process:\n')

0 commit comments

Comments
 (0)