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
})
}
}
这样就没问题了