Skip to content

Commit dc9940b

Browse files
committed
fix(build/serve): use chunk ouput as filename, closes #106
1 parent edae11c commit dc9940b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

__tests__/commands.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ describe('electron:serve', () => {
311311
mainConfig.resolve ? mainConfig.resolve.extensions : []
312312
).not.toContain('ts')
313313
// Proper entry file is used
314-
expect(mainConfig.entry.background[0]).toBe('projectPath/src/background.js')
314+
expect(mainConfig.entry.index[0]).toBe('projectPath/src/background.js')
315315
})
316316

317317
test('custom background file is used if provided', async () => {
@@ -325,9 +325,7 @@ describe('electron:serve', () => {
325325

326326
const mainConfig = webpack.mock.calls[0][0]
327327
// Proper entry file is used
328-
expect(mainConfig.entry.background[0]).toBe(
329-
'projectPath/customBackground.js'
330-
)
328+
expect(mainConfig.entry.index[0]).toBe('projectPath/customBackground.js')
331329
})
332330

333331
test('custom output dir is used if set in vue.config.js', async () => {

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function bundleMain ({
427427
config.output
428428
.path(api.resolve(outputDir + (isBuild ? '/bundled' : '')))
429429
// Electron will not detect background.js on dev server, only index.js
430-
.filename(isBuild ? 'background.js' : 'index.js')
430+
.filename('[name].js')
431431
if (isBuild) {
432432
// Set __static to __dirname (files in public get copied here)
433433
config
@@ -465,7 +465,9 @@ function bundleMain ({
465465
}
466466
])
467467
}
468-
config.entry('background').add(api.resolve(mainProcessFile))
468+
config
469+
.entry(isBuild ? 'background' : 'index')
470+
.add(api.resolve(mainProcessFile))
469471
if (usesTypescript) {
470472
config.resolve.extensions.merge(['.js', '.ts'])
471473
config.module

0 commit comments

Comments
 (0)