Skip to content

Commit

Permalink
docs(vite-legacy): Note about using regenerator-runtime in Content …
Browse files Browse the repository at this point in the history
…Security Policy environment (#7234)

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
  • Loading branch information
svilen-ivanov and bluwy committed Mar 10, 2022
1 parent 2351d79 commit 0fd6422
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-legacy/README.md
Expand Up @@ -173,6 +173,8 @@ These values (without the `sha256-` prefix) can also be retrieved via
const { cspHashes } = require('@vitejs/plugin-legacy')
```

When using the `regenerator-runtime` polyfill, it will attempt to use the `globalThis` object to register itself. If `globalThis` is not available (it is [fairly new](https://caniuse.com/?search=globalThis) and not widely supported, including IE 11), it attempts to perform dynamic `Function(...)` call which violates the CSP. To avoid dynamic `eval` in the absence of `globalThis` consider adding `core-js/proposals/global-this` to `additionalLegacyPolyfills` to define it.

## References

- [Vue CLI modern mode](https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode)
Expand Down

0 comments on commit 0fd6422

Please sign in to comment.