Meituan-Dianping/mpvue · error

Avoid overwriting built-in modifier in config.keyCodes: .${k

Error message

Avoid overwriting built-in modifier in config.keyCodes: .${key}

What it means

Comes from a Proxy set trap installed over config.keyCodes in the dev build. The trap checks the assigned key against isBuiltInModifier ('stop,prevent,self,ctrl,shift,alt,meta'); assigning any of those names to config.keyCodes triggers this warning because they collide with v-on/v-bind built-in event modifier names and would break modifier parsing in compiled templates. The assignment itself is otherwise permitted.

Source

Thrown at src/core/instance/proxy.js:34

  const warnNonPresent = (target, key) => {
    warn(
      `Property or method "${key}" is not defined on the instance but ` +
      `referenced during render. Make sure to declare reactive data ` +
      `properties in the data option.`,
      target
    )
  }

  const hasProxy =
    typeof Proxy !== 'undefined' &&
    Proxy.toString().match(/native code/)

  if (hasProxy) {
    const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta')
    config.keyCodes = new Proxy(config.keyCodes, {
      set (target, key, value) {
        if (isBuiltInModifier(key)) {
          warn(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`)
          return false
        } else {
          target[key] = value
          return true
        }
      }
    })
  }

  const hasHandler = {
    has (target, key) {
      const has = key in target
      const isAllowed = allowedGlobals(key) || key.charAt(0) === '_'
      if (!has && !isAllowed) {
        warnNonPresent(target, key)
      }
      return has || !isAllowed
    }

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Choose a keyCode alias that is not one of the built-in modifier names (stop, prevent, self, ctrl, shift, alt, meta)
  2. If you intended to customize a modifier's behavior, that is not supported — pick a new alias name for your custom key combination
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/instance/proxy.js:34 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/980dd28e4415cfc7. Report an issue: GitHub.