Meituan-Dianping/mpvue · error

Do not replace the Vue.config object, set individual fields

Error message

Do not replace the Vue.config object, set individual fields instead.

What it means

Vue.config is exposed via Object.defineProperty with only a getter; this warning comes from the dev-only setter trap that fires when code assigns to the Vue.config property as a whole (Vue.config = {...}). The assignment is silently discarded — the real config object is untouched — because replacing it would break the reactive internal references held throughout the framework.

Source

Thrown at src/core/global-api/index.js:26

import { set, del } from '../observer/index'
import { ASSET_TYPES } from 'shared/constants'
import builtInComponents from '../components/index'

import {
  warn,
  extend,
  nextTick,
  mergeOptions,
  defineReactive
} from '../util/index'

export function initGlobalAPI (Vue: GlobalAPI) {
  // config
  const configDef = {}
  configDef.get = () => config
  if (process.env.NODE_ENV !== 'production') {
    configDef.set = () => {
      warn(
        'Do not replace the Vue.config object, set individual fields instead.'
      )
    }
  }
  Object.defineProperty(Vue, 'config', configDef)

  // exposed util methods.
  // NOTE: these are not considered part of the public API - avoid relying on
  // them unless you are aware of the risk.
  Vue.util = {
    warn,
    extend,
    mergeOptions,
    defineReactive
  }

  Vue.set = set
  Vue.delete = del

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Set individual fields instead: Vue.config.silent = true, Vue.config.devtools = false, etc.
  2. If you need many changes, assign them one by one or use Object.assign(Vue.config, myOverrides) — never reassign Vue.config itself
  3. Audit build scripts and third-party plugins that try to wholesale replace Vue.config
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/global-api/index.js:26 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/f035ace60bc87ec2. Report an issue: GitHub.