首页 前端知识 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 前端知识 前端哥 926 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
标签
评论
发布的文章

JQuery中的load()、$

2024-05-10 08:05:15

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