diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index ed2c4a24820a61..dc5ec81e25c502 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -373,6 +373,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { type: 'module', + crossorigin: true, src: `${config.base}${modernPolyfillFilename}` } }) @@ -403,6 +404,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { nomodule: true, + crossorigin: true, id: legacyPolyfillId, src: `${config.base}${legacyPolyfillFilename}` }, @@ -423,6 +425,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { nomodule: true, + crossorigin: true, // we set the entry path on the element as an attribute so that the // script content will stay consistent - which allows using a constant // hash value for CSP.