If you are using the no longer maintained @vue/cli-service with webpack, it is caused by the fact that the tool does not define the default for this feature flag. It does so for the other two bundler feature flags, and while I created a PR to add this default (as I just hit this myself - https://github.com/vuejs/vue-cli/pull/7443), I do not expect it to get merged and released as the latest release is from July 2022.
So, you should define it yourself in the webpack configuration using the define plugin.
由于对<代码>vue.config.js的使用提出疑问,你可以确定如下:
const { defineConfig } = require( @vue/cli-service )
const webpack = require( webpack );
module.exports = defineConfig({
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
// Vue CLI is in maintenance mode, and probably won t merge my PR to fix this in their tooling
// https://github.com/vuejs/vue-cli/pull/7443
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false ,
})
],
},
});
见https://cli.vuejs.org/config/#configureweb Pack。