Meituan-Dianping/mpvue · error
option "${key}" can only be used during instance creation wi
Error message
option "${key}" can only be used during instance creation with the `new` keyword. What it means
Comes from the el/propsData option merge strategies in dev mode. These strategies receive the vm argument during mergeOptions; when vm is absent the merge is happening for a component definition (Vue.extend / component registration) rather than instance creation, and el/propsData are per-instance options that only make sense with 'new Vue(...)'. Declaring them on a component definition triggers this warning; the value is then merged with the default strategy but is ignored when the definition is used as a component.
Source
Thrown at src/core/util/options.js:35
capitalize,
isBuiltInTag,
isPlainObject
} from 'shared/util'
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*/
const strats = config.optionMergeStrategies
/**
* Options with restrictions
*/
if (process.env.NODE_ENV !== 'production') {
strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) {
warn(
`option "${key}" can only be used during instance ` +
'creation with the `new` keyword.'
)
}
return defaultStrat(parent, child)
}
}
/**
* Helper that recursively merges two data objects together.
*/
function mergeData (to: Object, from: ?Object): Object {
if (!from) return to
let key, toVal, fromVal
const keys = Object.keys(from)
for (let i = 0; i < keys.length; i++) {
key = keys[i]
toVal = to[key]View on GitHub (pinned to 6c5d78ee04)
Solutions
- Remove el/propsData from the component definition; pass them at instantiation: new Vue({ el: '#app', propsData })
- Supply mount targets via the $mount API or the el on the root instance only
- For props in tests, pass them through the mounting utility (e.g. propsData in vue-test-utils mount options) rather than the component options
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/util/options.js:35 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02).
Data as JSON: /api/errors/aa741137bdd68526.
Report an issue: GitHub.