Skip to content

Commit

Permalink
fix(cli-service): modify webpack config when overriding entry with CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcz committed Jun 17, 2020
1 parent a41cac2 commit 38c821a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions packages/@vue/cli-service/lib/commands/build/resolveAppConfig.js
@@ -1,4 +1,16 @@
module.exports = (api, args, options) => {
// respect inline entry
if (args.entry && !options.pages) {
api.chainWebpack(config => {
config.entryPoints
.clear()

config
.entry('app')
.add(api.resolve(args.entry))
})
}

const config = api.resolveChainableWebpackConfig()
const targetDir = api.resolve(args.dest || options.outputDir)

Expand Down Expand Up @@ -36,14 +48,5 @@ module.exports = (api, args, options) => {
}
}

const rawConfig = api.resolveWebpackConfig(config)

// respect inline entry
if (args.entry && !options.pages) {
const entry = api.resolve(args.entry)
rawConfig.entry = { app: entry }
process.env.VUE_CLI_ENTRY_FILES = JSON.stringify([entry])
}

return rawConfig
return api.resolveWebpackConfig(config)
}

0 comments on commit 38c821a

Please sign in to comment.