首页 前端知识 Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined. You are running the

Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined. You are running the

2024-02-25 11:02:30 前端知识 前端哥 932 119 我要收藏

使用vue-cli构建vue3项目时,一直有警告:   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.

未明确定义功能标志__VUE_PROD_HYDRATION_ISMATCH_DETAILS__。您正在运行Vue的esm-bundler构建,它希望通过bundler配置全局注入这些编译时功能标志,以便在生产捆绑包中更好地进行树抖动。

解决方法:

vue.config.js添加以下代码

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
})
},
复制

成功解决

转载请注明出处或者链接地址:https://www.qianduange.cn//article/2684.html
标签
评论
还可以输入200
共0条数据,当前/页
发布的文章

C/C | 每日一练 (2)

2025-02-24 13:02:49

Linux性能监控工具汇总

2025-02-24 13:02:48

Python常见面试题的详解16

2025-02-24 13:02:48

QQ登录测试用例报告

2025-02-24 13:02:47

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!