Skip to content

Commit e2e3469

Browse files
authored
chore!: ensure consistent directory structure for all modes (#4323)
BREAKING CHANGE: Changing directory strcuture, though now becoming more intuitive, may still break users' workflows, so it's considered a breaking change. Fixes #4215. Fixes #3767. Fixes #4234
1 parent 544faee commit e2e3469

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/@vue/cli-service/lib/config/app.js

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ module.exports = (api, options) => {
2323
const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
2424
const outputDir = api.resolve(options.outputDir)
2525

26+
const getAssetPath = require('../util/getAssetPath')
27+
const filename = getAssetPath(
28+
options,
29+
`js/[name]${isLegacyBundle ? `-legacy` : ``}${isProd && options.filenameHashing ? '.[contenthash:8]' : ''}.js`
30+
)
31+
webpackConfig
32+
.output
33+
.filename(filename)
34+
.chunkFilename(filename)
35+
2636
// code splitting
2737
if (process.env.NODE_ENV !== 'test') {
2838
webpackConfig

packages/@vue/cli-service/lib/config/prod.js

-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
module.exports = (api, options) => {
22
api.chainWebpack(webpackConfig => {
33
if (process.env.NODE_ENV === 'production') {
4-
const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
5-
const getAssetPath = require('../util/getAssetPath')
6-
const filename = getAssetPath(
7-
options,
8-
`js/[name]${isLegacyBundle ? `-legacy` : ``}${options.filenameHashing ? '.[contenthash:8]' : ''}.js`
9-
)
10-
114
webpackConfig
125
.mode('production')
136
.devtool(options.productionSourceMap ? 'source-map' : false)
14-
.output
15-
.filename(filename)
16-
.chunkFilename(filename)
177

188
// keep module.id stable when vendor modules does not change
199
webpackConfig

0 commit comments

Comments
 (0)