We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de9e9c4 commit 4aff4b9Copy full SHA for 4aff4b9
src/bootstrap-window.js
@@ -99,6 +99,18 @@
99
preferScriptTags: useCustomProtocol
100
};
101
102
+ // use a trusted types policy when loading via script tags
103
+ if (loaderConfig.preferScriptTags) {
104
+ loaderConfig.trustedTypesPolicy = window.trustedTypes?.createPolicy('amdLoader', {
105
+ createScriptURL(value) {
106
+ if (value.startsWith(window.location.origin)) {
107
+ return value;
108
+ }
109
+ throw new Error(`Invalid script url: ${value}`);
110
111
+ });
112
113
+
114
// Enable loading of node modules:
115
// - sandbox: we list paths of webpacked modules to help the loader
116
// - non-sandbox: we signal that any module that does not begin with
0 commit comments