解决Vue控制台报错:Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined

1、问题

开发vue项目过程中,发现这个报错,虽然好像不影响什么,但是看着确实有点难受啊。。

在这里插入图片描述

Feature flag VUE_PROD_HYDRATION_MISMATCH_DETAILS is not explicitly
defined. You are running the esm-bundler build of Vue, which expects
these compile-time feature flags to be globally injected via the
bundler config in order to get better tree-shaking in the production
bundle.

2、解决

在=vue.config.js加入下面配置:

module.exports = {
    
    
  chainWebpack: (config) => {
    
    
    config.plugin('define').tap((definitions) => {
    
    
      Object.assign(definitions[0], {
    
    
        __VUE_OPTIONS_API__: 'true',
        __VUE_PROD_DEVTOOLS__: 'false',
        __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
      })
      return definitions
    })
  }
}

这样就没问题了

猜你喜欢

转载自blog.csdn.net/m0_48300767/article/details/140975796