feat: bail when user directly mutate output.publicPath

This commit is contained in:
Evan You
2018-06-06 14:13:05 -04:00
parent 7f36fdfee9
commit 1732007ce8
2 changed files with 16 additions and 0 deletions

View File

@@ -191,6 +191,21 @@ module.exports = class Service {
config = merge(config, fn)
}
})
// check if the user has manually mutated output.publicPath
const target = process.env.VUE_CLI_BUILD_TARGET
const exceptionTargets = ['lib', 'wc', 'wc-async']
if (
!exceptionTargets.includes(target) &&
config.output.publicPath !== this.projectOptions.baseUrl
) {
error(
`Do not modify webpack output.publicPath directly. ` +
`Use the "baseUrl" option in vue.config.js instead.`
)
process.exit(1)
}
return config
}

View File

@@ -71,6 +71,7 @@ module.exports = (api, options) => {
}
// resolve raw webpack config
process.env.VUE_CLI_BUILD_TARGET = args.target
let webpackConfig
if (args.target === 'lib') {
webpackConfig = require('./resolveLibConfig')(api, args, options)