fix: polyfill injection when building app on multiple threads (#5592)

This commit is contained in:
dtcz
2020-06-22 17:05:04 +08:00
committed by GitHub
parent 66370e82c4
commit 326934e084
3 changed files with 14 additions and 11 deletions

View File

@@ -318,6 +318,8 @@ test('api: configureWebpack preserve ruleNames', () => {
})
test('internal: should correctly set VUE_CLI_ENTRY_FILES', () => {
delete process.env.VUE_CLI_ENTRY_FILES
const service = createMockService([{
id: 'test',
apply: api => {

View File

@@ -279,7 +279,10 @@ module.exports = class Service {
)
}
if (typeof config.entry !== 'function') {
if (
!process.env.VUE_CLI_ENTRY_FILES &&
typeof config.entry !== 'function'
) {
let entryFiles
if (typeof config.entry === 'string') {
entryFiles = [config.entry]

View File

@@ -1,4 +1,11 @@
module.exports = (api, args, options) => {
// respect inline entry
if (args.entry && !options.pages) {
api.configureWebpack(config => {
config.entry = { app: api.resolve(args.entry) }
})
}
const config = api.resolveChainableWebpackConfig()
const targetDir = api.resolve(args.dest || options.outputDir)
@@ -36,14 +43,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)
}