diff --git a/packages/runtime-core/src/featureFlags.ts b/packages/runtime-core/src/featureFlags.ts index 6dd136277bd..34deb0a3006 100644 --- a/packages/runtime-core/src/featureFlags.ts +++ b/packages/runtime-core/src/featureFlags.ts @@ -25,6 +25,11 @@ export function initFeatureFlags() { getGlobalThis().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = false } + if (typeof __FEATURE_PROD_TRUSTED_TYPES__ !== 'boolean') { + __DEV__ && needWarn.push(`__VUE_PROD_TRUSTED_TYPES__`) + getGlobalThis().__VUE_PROD_TRUSTED_TYPES__ = false + } + if (__DEV__ && needWarn.length) { const multi = needWarn.length > 1 console.warn( diff --git a/packages/vue/README.md b/packages/vue/README.md index 2aca524e03d..364201a219c 100644 --- a/packages/vue/README.md +++ b/packages/vue/README.md @@ -49,6 +49,10 @@ - Default: `false` - Enable / disable detailed warnings for hydration mismatches in production +- `__VUE_PROD_TRUSTED_TYPES__` + - Default: `false` + - Enable / disable built-in Trusted Types Policy for compatibility with the [`trusted-types` CSP directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types) + The build will work without configuring these flags, however it is **strongly recommended** to properly configure them in order to get proper tree-shaking in the final bundle. ### For Server-Side Rendering