首页 前端知识 Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined...

Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined...

2024-03-11 10:03:18 前端知识 前端哥 461 523 我要收藏

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.

不知道什么时候控制台就出现了一个黄色警告,刚开始没在意,觉得我代码写完应该就没了,结果一直在……有点点强迫症,就搜了一下解决办法[😁],但是那位博主加的有点多,我就加了几句也解决了,就没管其他的了。(啰嗦如我)

在vite.config.ts里面加这一段:

import { defineConfig } from "vite";

export default defineConfig({
  define: {
    __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
  },
});

OK,控制台干净了。 

参考博文:

https://blog.csdn.net/cg_ssh/article/details/135396904

转载请注明出处或者链接地址:https://www.qianduange.cn//article/3618.html
标签
评论
会员中心 联系我 留言建议 回顶部
复制成功!