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

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐