Skip to content

Commit 88a8847

Browse files
committed
feat(build): name main process file index.js instead of background.js
1 parent 7f6c25f commit 88a8847

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

generator/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ module.exports = (api, options = {}) => {
115115
api.extendPackage({
116116
scripts,
117117
dependencies,
118-
devDependencies,
119-
main: 'background.js'
118+
devDependencies
120119
})
121120
}

index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ module.exports = (api, options) => {
233233
// Copy main process file instead of bundling it
234234
fs.copySync(
235235
api.resolve(mainProcessFile),
236-
api.resolve(`${outputDir}/bundled/background.js`)
236+
api.resolve(`${outputDir}/bundled/index.js`)
237237
)
238238
buildApp(args.skipElectronBuild)
239239
}
@@ -560,8 +560,7 @@ function bundleMain ({
560560

561561
config.output
562562
.path(api.resolve(outputDir + (isBuild ? '/bundled' : '')))
563-
// Electron will not detect background.js on dev server, only index.js
564-
.filename('[name].js')
563+
.filename('index.js')
565564
const envVars = {}
566565
if (isBuild) {
567566
// Set __static to __dirname (files in public get copied here)
@@ -633,9 +632,7 @@ function bundleMain ({
633632
let preloadConfig = new Config()
634633

635634
mainConfig.target('electron-main')
636-
mainConfig
637-
.entry(isBuild ? 'background' : 'index')
638-
.add(api.resolve(mainProcessFile))
635+
mainConfig.entry('index').add(api.resolve(mainProcessFile))
639636

640637
preloadConfig.target('electron-preload')
641638
let preload = pluginOptions.preload

0 commit comments

Comments
 (0)