vuejs/vue-cli · error · Error
'url' and 'path' can't be defined at the same time.
Error message
'url' and 'path' can't be defined at the same time.
What it means
In vue-cli-ui, PluginApi.addClientAddon registers a client addon either by dev-server `url` or by local bundle `path`. The two are mutually exclusive because each fully specifies how to load the addon; defining both is ambiguous and is rejected before the addon is pushed.
Source
Thrown at packages/@vue/cli-ui/apollo-server/api/PluginApi.js:247
* Used to load components and add vue-router routes.
*
* @param {object} options Client addon options
* {
* id: string,
* url: string
* }
* or
* {
* id: string,
* path: string
* }
*/
addClientAddon (options) {
if (this.lightMode) return
try {
validateClientAddon(options)
if (options.url && options.path) {
throw new Error('\'url\' and \'path\' can\'t be defined at the same time.')
}
this.clientAddons.push({
...options,
pluginId: this.pluginId
})
} catch (e) {
logs.add({
type: 'error',
tag: 'PluginApi',
message: `(${this.pluginId || 'unknown plugin'}) 'addClientAddon' options are invalid\n${e.message}`
}, this.context)
console.error(new Error(`Invalid options: ${e.message}`))
}
}
/* Project view */
/**View on GitHub (pinned to 7eb93c169c)
Solutions
- Provide only `url` (dev server) or only `path` (local bundle), not both.
- Conditionally pick one based on NODE_ENV.
Example fix
// before
api.addClientAddon({ id: 'foo', url: 'http://localhost:8080', path: './dist' })
// after
const isDev = process.env.NODE_ENV !== 'production'
api.addClientAddon(isDev ? { id: 'foo', url: 'http://localhost:8080' } : { id: 'foo', path: './dist' }) Defensive patterns
Strategy: type-guard
Validate before calling
if (options.url && options.path) {
throw new Error("addClientAddon: provide 'url' or 'path', not both")
} Type guard
const isExclusiveAddonSource = (o) => !(o.url && o.path)
Try / catch
try { api.addClientAddon(options) } catch (e) { /* drop one of url/path based on env, then retry */ } Prevention
- Pick url (dev) or path (built bundle) per environment, never both.
- Build the addon options object from a single source field.
When it happens
Trigger: A UI plugin calling `api.addClientAddon({ id, url, path })` with both `url` and `path` set.
Common situations: Copy-pasting an addon options object that carried both fields; leftover dev `url` while also pointing at a built `path`.
Related errors
- Cannot find polyfill ${item}, please refer to 'core-js-compa
- transpileDependencies only accepts an array of string or reg
- ${workboxPluginMode} is not a supported Workbox webpack plug
- Invalid type for option 'vuePlugins.service', expected 'arra
- Do not modify webpack output.publicPath directly. Use the "p
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/054b842cb17316f0.
Report an issue: GitHub.