Skip to content

Commit

Permalink
docs: add documentation about the __VUE_PROD_TRUSTED_TYPES__ flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed May 8, 2024
1 parent 47622e8 commit 4b8e4ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/runtime-core/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions packages/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b8e4ce

Please sign in to comment.