Skip to content

Commit

Permalink
fix: polyfill injection when building app on multiple threads (#5592)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcz committed Jun 22, 2020
1 parent 66370e8 commit 326934e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/@vue/cli-service/__tests__/Service.spec.js
Expand Up @@ -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 => {
Expand Down
5 changes: 4 additions & 1 deletion packages/@vue/cli-service/lib/Service.js
Expand Up @@ -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]
Expand Down
18 changes: 8 additions & 10 deletions packages/@vue/cli-service/lib/commands/build/resolveAppConfig.js
@@ -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)

Expand Down Expand Up @@ -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)
}

0 comments on commit 326934e

Please sign in to comment.