找回密码
 注册
查看: 50|回复: 0

解决vue访问警告:Feature flag __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2025-7-28 10:52:01 | 显示全部楼层 |阅读模式
main.ts:7 Feature flag__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ is not explicitly defined. You arerunning the esm-bundler build of Vue, which expects these compile-time featureflags to be globally injected via the bundler config in order to get bettertree-shaking in the production bundle.
; G! h! k  L6 E2 E
解决办法:
需要在vue.config.js文件中添加配置:
const { defineConfig } =require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
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
   })
  }
}

* A. }* ?* z# J1 ~4 z
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:11 , Processed in 0.017126 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表