diff --git a/packages/core/src/module/app.ts b/packages/core/src/module/app.ts index 0b5b2ec73..d65eee444 100644 --- a/packages/core/src/module/app.ts +++ b/packages/core/src/module/app.ts @@ -714,10 +714,9 @@ export class App { async: false, defer: false, isInline: jsManager.isInlineScript(), - noEntry: toBoolean( - entryManager.findAttributeValue(node, 'no-entry') || - this.isNoEntryScript(targetUrl), - ), + noEntry: + toBoolean(entryManager.findAttributeValue(node, 'no-entry')) || + toBoolean(this.isNoEntryScript(targetUrl)), originScript: mockOriginScript, }); } diff --git a/packages/core/src/module/resource.ts b/packages/core/src/module/resource.ts index 7e20e1de8..dcd73ce8a 100644 --- a/packages/core/src/module/resource.ts +++ b/packages/core/src/module/resource.ts @@ -22,10 +22,13 @@ function fetchStaticResources( .map((node) => { const src = entryManager.findAttributeValue(node, 'src'); const type = entryManager.findAttributeValue(node, 'type'); - const crossOrigin = entryManager.findAttributeValue( + let crossOrigin = entryManager.findAttributeValue( node, 'crossorigin', ); + if (crossOrigin === '') { + crossOrigin = 'anonymous'; + } // There should be no embedded script in the script element tag with the src attribute specified if (src) { diff --git a/packages/loader/src/managers/template.ts b/packages/loader/src/managers/template.ts index 84b14d6a8..ad0dba6eb 100644 --- a/packages/loader/src/managers/template.ts +++ b/packages/loader/src/managers/template.ts @@ -144,7 +144,7 @@ export class TemplateManager { } findAttributeValue(node: Node, type: string) { - return node.attributes?.find(({ key }) => key === type)?.value || undefined; + return node.attributes?.find(({ key }) => key === type)?.value ?? undefined; } cloneNode(node: Node) {