mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-02-09 00:18:28 -06:00
feat: bail when user directly mutate output.publicPath
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user