Skip to content

Commit 38c821a

Browse files
committed
fix(cli-service): modify webpack config when overriding entry with CLI
1 parent a41cac2 commit 38c821a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

packages/@vue/cli-service/lib/commands/build/resolveAppConfig.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
module.exports = (api, args, options) => {
2+
// respect inline entry
3+
if (args.entry && !options.pages) {
4+
api.chainWebpack(config => {
5+
config.entryPoints
6+
.clear()
7+
8+
config
9+
.entry('app')
10+
.add(api.resolve(args.entry))
11+
})
12+
}
13+
214
const config = api.resolveChainableWebpackConfig()
315
const targetDir = api.resolve(args.dest || options.outputDir)
416

@@ -36,14 +48,5 @@ module.exports = (api, args, options) => {
3648
}
3749
}
3850

39-
const rawConfig = api.resolveWebpackConfig(config)
40-
41-
// respect inline entry
42-
if (args.entry && !options.pages) {
43-
const entry = api.resolve(args.entry)
44-
rawConfig.entry = { app: entry }
45-
process.env.VUE_CLI_ENTRY_FILES = JSON.stringify([entry])
46-
}
47-
48-
return rawConfig
51+
return api.resolveWebpackConfig(config)
4952
}

0 commit comments

Comments
 (0)