vuejs/vue-cli · error · Error
Configuration Error: Avoid modifying webpack output.public
Error message
Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead.
What it means
For the 'app' build target, validateWebpackConfig ensures webpack's `output.publicPath` still equals the configured `publicPath` option. A direct mutation in configureWebpack/chainWebpack is rejected because it bypasses the option system that other plugins depend on.
Source
Thrown at packages/@vue/cli-service/lib/util/validateWebpackConfig.js:32
// user directly modifies output.path in configureWebpack or chainWebpack.
// this is not supported because there's no way for us to give copy
// plugin the correct value this way.
throw new Error(
`\n\nConfiguration Error: ` +
`Avoid modifying webpack output.path directly. ` +
`Use the "outputDir" option instead.\n`
)
}
if (actualTargetDir === api.service.context) {
throw new Error(
`\n\nConfiguration Error: ` +
`Do not set output directory to project root.\n`
)
}
if (target === 'app' && singleConfig.output.publicPath !== options.publicPath) {
throw new Error(
`\n\nConfiguration Error: ` +
`Avoid modifying webpack output.publicPath directly. ` +
`Use the "publicPath" option instead.\n`
)
}
}
View on GitHub (pinned to 7eb93c169c)
Solutions
- Set `publicPath` in vue.config.js instead.
- Remove the `config.output.publicPath = ...` line from your webpack hooks.
Example fix
// vue.config.js — before (in chainWebpack)
config.output.publicPath = '/app/'
// after
module.exports = { publicPath: '/app/' } Defensive patterns
Strategy: validation
Validate before calling
// inside your webpack hook — never mutate; assert equality
if (config.output.publicPath !== options.publicPath) {
throw new Error('Refusing to mutate output.publicPath; set the publicPath option instead')
} Prevention
- Treat output.publicPath as read-only in chainWebpack/configureWebpack.
- Set base URL via the publicPath option in vue.config.js.
When it happens
Trigger: In a webpack hook setting `config.output.publicPath = '/'` (or any value) for an app build.
Common situations: Copy-pasted webpack config that sets publicPath; plugins that override publicPath unconditionally.
Related errors
- Do not modify webpack output.publicPath directly. Use the "p
- Configuration Error: Avoid modifying webpack output.path d
- Configuration Error: Do not set output directory to projec
- Cannot find polyfill ${item}, please refer to 'core-js-compa
- transpileDependencies only accepts an array of string or reg
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/09c447a19d76f59d.
Report an issue: GitHub.