Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: ensure consistent directory structure for all modes #4323

Merged
merged 1 commit into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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