diff --git a/src/__tests__/fixtures/basic-template-plugin-custom-runtime-id/__snapshots__/server--main.js b/src/__tests__/fixtures/basic-template-plugin-custom-runtime-id/__snapshots__/server--main.js
index f3202f0..4622b25 100644
--- a/src/__tests__/fixtures/basic-template-plugin-custom-runtime-id/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/basic-template-plugin-custom-runtime-id/__snapshots__/server--main.js
@@ -99,12 +99,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp_testruntime=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/__tests__/fixtures/basic-template-plugin/__snapshots__/server--main.js b/src/__tests__/fixtures/basic-template-plugin/__snapshots__/server--main.js
index abe32a4..45d2665 100644
--- a/src/__tests__/fixtures/basic-template-plugin/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/basic-template-plugin/__snapshots__/server--main.js
@@ -99,12 +99,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/__tests__/fixtures/multiple-entries-plugin/__snapshots__/server--main.js b/src/__tests__/fixtures/multiple-entries-plugin/__snapshots__/server--main.js
index 7292306..f55c243 100644
--- a/src/__tests__/fixtures/multiple-entries-plugin/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/multiple-entries-plugin/__snapshots__/server--main.js
@@ -88,12 +88,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
@@ -260,12 +260,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/__tests__/fixtures/with-class-component-plugin-dynamic-bundle/__snapshots__/server--main.js b/src/__tests__/fixtures/with-class-component-plugin-dynamic-bundle/__snapshots__/server--main.js
index d657929..995f2df 100644
--- a/src/__tests__/fixtures/with-class-component-plugin-dynamic-bundle/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/with-class-component-plugin-dynamic-bundle/__snapshots__/server--main.js
@@ -161,12 +161,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/__tests__/fixtures/with-class-component-plugin/__snapshots__/server--main.js b/src/__tests__/fixtures/with-class-component-plugin/__snapshots__/server--main.js
index 3fc613d..808316e 100644
--- a/src/__tests__/fixtures/with-class-component-plugin/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/with-class-component-plugin/__snapshots__/server--main.js
@@ -154,12 +154,12 @@ function renderAssets() {
__webpack_require__.p && this.script(`$mwp=${JSON.stringify(__webpack_require__.p)}`);
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/__tests__/fixtures/with-public-path/__snapshots__/server--main.js b/src/__tests__/fixtures/with-public-path/__snapshots__/server--main.js
index f3143ca..2a9876b 100644
--- a/src/__tests__/fixtures/with-public-path/__snapshots__/server--main.js
+++ b/src/__tests__/fixtures/with-public-path/__snapshots__/server--main.js
@@ -99,12 +99,12 @@ function renderAssets() {
if (assets.js) {
- const setNonce = nonce && `.setAttribute("nonce", ${JSON.stringify(nonce)})`;
- this.script(
- `(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;${setNonce ? `g${setNonce};` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,${setNonce ? `a${setNonce},` : ""}b.head.appendChild(a))})})(document,${
- JSON.stringify(assets.js.map(js => __webpack_require__.p+js))
- })`
- );
+ const nonceAttr = nonce ? ` nonce=${JSON.stringify(nonce)}` : "";
+ assets.js.forEach(js => {
+ this.write(
+ ``
+ );
+ });
}
if (assets.css) {
diff --git a/src/loader/get-asset-code.ts b/src/loader/get-asset-code.ts
index 10d72f9..c4b63e2 100644
--- a/src/loader/get-asset-code.ts
+++ b/src/loader/get-asset-code.ts
@@ -29,12 +29,12 @@ static function renderAssets() {
}
if (assets.js) {
- const setNonce = nonce && \`.setAttribute("nonce", \${JSON.stringify(nonce)})\`;
- this.script(
- \`(function(b,h){var e=[],c=0;h.forEach(function(d,f){var a=b.createElement("link");a.relList&&a.relList.supports&&a.relList.supports("preload")?(a.href=d,a.rel="preload",a.as="script",a.addEventListener("load",function(){e[f]=d;if(c===f)for(var a;a=e[c];c++){var g=b.createElement("script");g.src=a;\${setNonce ? \`g\${setNonce};\` : ""}b.head.appendChild(g)}}),b.head.appendChild(a)):(a=b.createElement("script"),a.src=d,a.defer=!0,\${setNonce ? \`a\${setNonce},\` : ""}b.head.appendChild(a))})})(document,\${
- JSON.stringify(assets.js.map(js => __webpack_public_path__+js))
- })\`
- );
+ const nonceAttr = nonce ? \` nonce=\${JSON.stringify(nonce)}\` : "";
+ assets.js.forEach(js => {
+ this.write(
+ \`\`
+ );
+ });
}
if (assets.css) {