Skip to content

Commit

Permalink
chore!: ensure consistent directory structure for all modes (#4323)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
haoqunjiang authored Jul 21, 2019
1 parent 544faee commit e2e3469
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 10 additions & 0 deletions packages/@vue/cli-service/lib/config/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ module.exports = (api, options) => {
const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
const outputDir = api.resolve(options.outputDir)

const getAssetPath = require('../util/getAssetPath')
const filename = getAssetPath(
options,
`js/[name]${isLegacyBundle ? `-legacy` : ``}${isProd && options.filenameHashing ? '.[contenthash:8]' : ''}.js`
)
webpackConfig
.output
.filename(filename)
.chunkFilename(filename)

// code splitting
if (process.env.NODE_ENV !== 'test') {
webpackConfig
Expand Down
10 changes: 0 additions & 10 deletions packages/@vue/cli-service/lib/config/prod.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
module.exports = (api, options) => {
api.chainWebpack(webpackConfig => {
if (process.env.NODE_ENV === 'production') {
const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
const getAssetPath = require('../util/getAssetPath')
const filename = getAssetPath(
options,
`js/[name]${isLegacyBundle ? `-legacy` : ``}${options.filenameHashing ? '.[contenthash:8]' : ''}.js`
)

webpackConfig
.mode('production')
.devtool(options.productionSourceMap ? 'source-map' : false)
.output
.filename(filename)
.chunkFilename(filename)

// keep module.id stable when vendor modules does not change
webpackConfig
Expand Down

0 comments on commit e2e3469

Please sign in to comment.