From 83254dc92ae14eeb8bc299a4d9a81f3b40a7c3eb Mon Sep 17 00:00:00 2001 From: zuochenxue Date: Wed, 25 May 2022 16:08:23 +0800 Subject: [PATCH 1/2] fix(build): use crossorigin for nomodule --- packages/plugin-legacy/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index ed2c4a24820a61..4a8f688a42352c 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -403,6 +403,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { nomodule: true, + crossorigin: true, id: legacyPolyfillId, src: `${config.base}${legacyPolyfillFilename}` }, @@ -423,6 +424,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. From 9ec82d4de12db39ca4b4a2e5ea1ca9d92ef3be4b Mon Sep 17 00:00:00 2001 From: sapphi-red Date: Thu, 2 Jun 2022 01:07:24 +0900 Subject: [PATCH 2/2] fix(build): use crossorigin for modern polyfill --- packages/plugin-legacy/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index 4a8f688a42352c..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}` } })