Skip to content

Commit c057a39

Browse files
committed
Merge branch 'master' into next
2 parents 65dfc15 + b8f181f commit c057a39

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎lib/JsonpMainTemplate.runtime.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
5+
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ $crossOriginLoading$ */
66
module.exports = function() {
77
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
88
hotAddUpdateChunk(chunkId, moreModules);
@@ -14,6 +14,7 @@ module.exports = function() {
1414
var script = document.createElement("script");
1515
script.charset = "utf-8";
1616
script.src = $require$.p + $hotChunkFilename$;
17+
$crossOriginLoading$;
1718
head.appendChild(script);
1819
}
1920

‎lib/JsonpMainTemplatePlugin.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class JsonpMainTemplatePlugin {
216216
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
217217
const hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
218218
const hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
219+
const crossOriginLoading = this.outputOptions.crossOriginLoading;
219220
const hotUpdateFunction = this.outputOptions.hotUpdateFunction;
220221
const currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
221222
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
@@ -231,6 +232,7 @@ class JsonpMainTemplatePlugin {
231232
const runtimeSource = Template.getFunctionContent(require("./JsonpMainTemplate.runtime.js"))
232233
.replace(/\/\/\$semicolon/g, ";")
233234
.replace(/\$require\$/g, this.requireFn)
235+
.replace(/\$crossOriginLoading\$/g, crossOriginLoading ? `script.crossOrigin = ${JSON.stringify(crossOriginLoading)}` : "")
234236
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
235237
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
236238
.replace(/\$hash\$/g, JSON.stringify(hash));

0 commit comments

Comments
 (0)