From 7f59989ec1fee7f8b71d297169589e010d3b84e3 Mon Sep 17 00:00:00 2001 From: ZuoChenxue <276657773@qq.com> Date: Thu, 2 Jun 2022 03:55:52 +0800 Subject: [PATCH] fix(build): use crossorigin for nomodule (#8322) Co-authored-by: sapphi-red --- packages/plugin-legacy/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index 05e276ca3b1ff8..4aaab1aab2412d 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -360,6 +360,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { type: 'module', + crossorigin: true, src: `${config.base}${modernPolyfillFilename}` } }) @@ -390,6 +391,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { tag: 'script', attrs: { nomodule: true, + crossorigin: true, id: legacyPolyfillId, src: `${config.base}${legacyPolyfillFilename}` }, @@ -412,6 +414,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.