Skip to content

Commit f237276

Browse files
Copilotdmichon-msft
andcommitted
Fix syntax errors in chunks by using property access token
- Changed module token from `__WEBPACK_CHUNK_MODULE__hash` to `(){this["__WEBPACK_CHUNK_MODULE__hash"]}` - This creates syntactically valid JavaScript that terser can parse and minify - After minification, terser converts bracket notation to dot notation: `this.__WEBPACK_CHUNK_MODULE__hash` - Updated CHUNK_MODULE_REGEX to match the minified format - All tests passing with no syntax errors in chunks - Terser can now successfully minify assets containing module placeholders Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
1 parent cb7e191 commit f237276

4 files changed

Lines changed: 111 additions & 115 deletions

File tree

webpack/webpack5-module-minifier-plugin/src/Constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ export const MODULE_WRAPPER_SHORTHAND_SUFFIX: '});' = '});';
3939
export const CHUNK_MODULE_TOKEN: '__WEBPACK_CHUNK_MODULE__' = '__WEBPACK_CHUNK_MODULE__';
4040

4141
/**
42-
* RegExp for replacing chunk module placeholders
42+
* RegExp for replacing chunk module placeholders with property access format
43+
* Matches both bracket and dot notation after minification
4344
* @public
4445
*/
45-
export const CHUNK_MODULE_REGEX: RegExp = /__WEBPACK_CHUNK_MODULE__([A-Za-z0-9$_]+)/g;
46+
export const CHUNK_MODULE_REGEX: RegExp = new RegExp('this\\.?__WEBPACK_CHUNK_MODULE__([A-Za-z0-9$_]+)', 'g');
4647

4748
/**
4849
* Stage # to use when this should be the first tap in the hook

webpack/webpack5-module-minifier-plugin/src/ModuleMinifierPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ export class ModuleMinifierPlugin implements WebpackPluginInstance {
475475
);
476476
}
477477

478-
const result: sources.Source = new RawSource(`${CHUNK_MODULE_TOKEN}${hash}`);
478+
// Create a syntactically valid token using property access with string literal
479+
// The string in bracket notation won't be minified
480+
const result: sources.Source = new RawSource(`(){this["${CHUNK_MODULE_TOKEN}${hash}"]}`);
479481
sourceCache.set(source, {
480482
hash,
481483
source: result,

webpack/webpack5-module-minifier-plugin/src/test/__snapshots__/AmdExternals.test.ts.snap

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,12 @@
33
exports[`ModuleMinifierPlugin Handles AMD externals (mock): Content 1`] = `
44
Object {
55
"/release/async.js": "/*! For license information please see async.js.LICENSE.txt */
6-
// Begin Asset Hash=cfb7f7d353fd9d01c51f613f9235ad90b50fe78f746b088cf52a92517a5fc458
6+
// Begin Asset Hash=a456058e8bc0789eabb8a4b066fc9119ac733b212125375bf9270414d15ef6b7
77
\\"use strict\\";
88
(self[\\"webpackChunk\\"] = self[\\"webpackChunk\\"] || []).push([[157],{
99
1010
/***/ 541
11-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12-
13-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14-
/* harmony export */ foo: () => (/* binding */ foo)
15-
/* harmony export */ });
16-
/* harmony import */ var bar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(885);
17-
/* harmony import */ var bar__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bar__WEBPACK_IMPORTED_MODULE_0__);
18-
/* harmony import */ var baz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(653);
19-
/* harmony import */ var baz__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(baz__WEBPACK_IMPORTED_MODULE_1__);
20-
// @license MIT
21-
22-
23-
function foo() { bar__WEBPACK_IMPORTED_MODULE_0___default().a(); baz__WEBPACK_IMPORTED_MODULE_1___default().b(); }console.log(\\"Test character lengths: ￯\\")
24-
25-
/***/ }
26-
11+
(){this[\\"__WEBPACK_CHUNK_MODULE__aa928190bac95603578bbc24c65647633e6305dc69d46edaf07d710fc69da78d\\"]}
2712
2813
}]);
2914
// End Asset",
@@ -321,12 +306,7 @@ Object {
321306
"positionByModuleId": Map {},
322307
},
323308
"async.js" => Object {
324-
"positionByModuleId": Map {
325-
541 => Object {
326-
"charLength": 846,
327-
"charOffset": 239,
328-
},
329-
},
309+
"positionByModuleId": Map {},
330310
},
331311
},
332312
"byModule": Map {
@@ -339,20 +319,39 @@ Object {
339319
340320
exports[`ModuleMinifierPlugin Handles AMD externals (mock): Warnings 1`] = `Array []`;
341321
342-
exports[`ModuleMinifierPlugin Handles AMD externals (terser): Content 1`] = `Object {}`;
343-
344-
exports[`ModuleMinifierPlugin Handles AMD externals (terser): Errors 1`] = `
345-
Array [
346-
Object {
347-
"message": "Unexpected token name «__WEBPACK_CHUNK_MODULE__aa928190bac95603578bbc24c65647633e6305dc69d46edaf07d710fc69da78d», expected punc «,»",
348-
},
349-
]
322+
exports[`ModuleMinifierPlugin Handles AMD externals (terser): Content 1`] = `
323+
Object {
324+
"/release/async.js": "/*! For license information please see async.js.LICENSE.txt */
325+
\\"use strict\\";(self.webpackChunk=self.webpackChunk||[]).push([[157],{541(){(e,t,n){n.d(t,{foo:()=>s});var a=n(885),i=n.n(a),r=n(653),o=n.n(r);function s(){i().a(),o().b()}console.log(\\"Test character lengths: \\\\ufeff￯\\")}
326+
}}]);",
327+
"/release/async.js.LICENSE.txt": "// @license MIT
328+
",
329+
"/release/main.js": "define([\\"bar\\",\\"baz\\"],(e,t)=>(()=>{var n,a={885(t){\\"use strict\\";t.exports=e},653(e){\\"use strict\\";e.exports=t}},i={};function r(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return a[e](n,n.exports,r),n.exports}r.m=a,r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((t,n)=>(r.f[n](e,t),t),[])),r.u=e=>\\"async.js\\",r.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},r.l=(e,t,a,i)=>{if(n[e])n[e].push(t);else{var o,s;if(void 0!==a)for(var c=document.getElementsByTagName(\\"script\\"),d=0;d<c.length;d++){var l=c[d];if(l.getAttribute(\\"src\\")==e){o=l;break}}o||(s=!0,(o=document.createElement(\\"script\\")).charset=\\"utf-8\\",r.nc&&o.setAttribute(\\"nonce\\",r.nc),o.src=e),n[e]=[t];var u=(t,a)=>{o.onerror=o.onload=null,clearTimeout(f);var i=n[e];if(delete n[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(a)),t)return t(a)},f=setTimeout(u.bind(null,void 0,{type:\\"timeout\\",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),s&&document.head.appendChild(o)}},(()=>{var e;r.g.importScripts&&(e=r.g.location+\\"\\");var t=r.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName(\\"script\\");if(n.length)for(var a=n.length-1;a>-1&&(!e||!/^http(s?):/.test(e));)e=n[a--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),r.p=e})(),(()=>{var e={792:0};r.f.j=(t,n)=>{var a=r.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else{var i=new Promise((n,i)=>a=e[t]=[n,i]);n.push(a[2]=i);var o=r.p+r.u(t),s=new Error;r.l(o,n=>{if(r.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=n&&(\\"load\\"===n.type?\\"missing\\":n.type),o=n&&n.target&&n.target.src;s.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+i+\\": \\"+o+\\")\\",s.name=\\"ChunkLoadError\\",s.type=i,s.request=o,a[1](s)}},\\"chunk-\\"+t,t)}};var t=(t,n)=>{var a,i,[o,s,c]=n,d=0;if(o.some(t=>0!==e[t])){for(a in s)r.o(s,a)&&(r.m[a]=s[a]);if(c)c(r)}for(t&&t(n);d<o.length;d++)i=o[d],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();return console.log(\\"Do stuff\\"),r.e(157).then(r.bind(r,541)).then(e=>e.foo()),{}})());",
330+
}
350331
`;
351332
333+
exports[`ModuleMinifierPlugin Handles AMD externals (terser): Errors 1`] = `Array []`;
334+
352335
exports[`ModuleMinifierPlugin Handles AMD externals (terser): Metadata 1`] = `
353336
Object {
354-
"byAssetFilename": Map {},
355-
"byModule": Map {},
337+
"byAssetFilename": Map {
338+
"main.js" => Object {
339+
"positionByModuleId": Map {},
340+
},
341+
"async.js" => Object {
342+
"positionByModuleId": Map {
343+
541 => Object {
344+
"charLength": 143,
345+
"charOffset": 137,
346+
},
347+
},
348+
},
349+
},
350+
"byModule": Map {
351+
541 => Map {
352+
157 => 145,
353+
},
354+
},
356355
}
357356
`;
358357

webpack/webpack5-module-minifier-plugin/src/test/__snapshots__/MultipleRuntimes.test.ts.snap

Lines changed: 73 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,31 @@
33
exports[`ModuleMinifierPlugin Handles multiple runtimes (mock): Content 1`] = `
44
Object {
55
"/release/async-1.js": "/*! For license information please see async-1.js.LICENSE.txt */
6-
// Begin Asset Hash=b53e0a088f83c5d7fc7ba3ca806e0471adea1460f448a26004ed99835ccffac3
6+
// Begin Asset Hash=21350ec888fa12653cdb73049b503d4ba3d2defb943a3ab8838aeca813f711ba
77
\\"use strict\\";
88
(self[\\"webpackChunk\\"] = self[\\"webpackChunk\\"] || []).push([[527],{
99
1010
/***/ 923
11-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
12-
13-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14-
/* harmony export */ async1: () => (/* binding */ async1)
15-
/* harmony export */ });
16-
// @license BAR
17-
function async1() { console.log('async-1'); }
18-
19-
/***/ }
20-
,
11+
(){this[\\"__WEBPACK_CHUNK_MODULE__522ee27cac2edf706f26b73b1e5ec4bc44feefe1107c5e303f671547dff3b8d1\\"]},
2112
2213
/***/ 541
23-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
24-
25-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26-
/* harmony export */ async1: () => (/* reexport safe */ _async_1__WEBPACK_IMPORTED_MODULE_0__.async1)
27-
/* harmony export */ });
28-
/* harmony import */ var _async_1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(923);
29-
// @license MIT
30-
31-
32-
33-
/***/ }
34-
14+
(){this[\\"__WEBPACK_CHUNK_MODULE__14a0bb00c5013f9feddec4295e04895cfcfa3097bb63589ab295671d5160d6d7\\"]}
3515
3616
}]);
3717
// End Asset",
3818
"/release/async-1.js.LICENSE.txt": "// @license BAR
3919
// @license MIT
4020
",
4121
"/release/async-2.js": "/*! For license information please see async-2.js.LICENSE.txt */
42-
// Begin Asset Hash=2e943d5dc5a407a894b565d54ceeb3f554742f52442d698c22b8795be4d4694c
22+
// Begin Asset Hash=a56fdb116caaeb43d8c34b70e346d45e89446612da61b2946c8e0c86a5f45149
4323
\\"use strict\\";
4424
(self[\\"webpackChunk\\"] = self[\\"webpackChunk\\"] || []).push([[324],{
4525
4626
/***/ 454
47-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
48-
49-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
50-
/* harmony export */ a2: () => (/* binding */ a2)
51-
/* harmony export */ });
52-
// @license BAZ
53-
function a2() { console.log('async-2'); }
54-
55-
/***/ }
56-
,
27+
(){this[\\"__WEBPACK_CHUNK_MODULE__9fa9db01a39f213b0bad42889493581d8a3cc9d76f3b77543aa34e2cfc6622ed\\"]},
5728
5829
/***/ 541
59-
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
60-
61-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
62-
/* harmony export */ a2: () => (/* reexport safe */ _async_2__WEBPACK_IMPORTED_MODULE_1__.a2)
63-
/* harmony export */ });
64-
/* harmony import */ var _async_2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(454);
65-
// @license MIT
66-
67-
68-
69-
/***/ }
70-
30+
(){this[\\"__WEBPACK_CHUNK_MODULE__3fec3b0c7ee16396d8ef12681a9752d11a86a589b744cebb7451ad0a1b16a50b\\"]}
7131
7232
}]);
7333
// End Asset",
@@ -589,28 +549,10 @@ Object {
589549
"positionByModuleId": Map {},
590550
},
591551
"async-1.js" => Object {
592-
"positionByModuleId": Map {
593-
923 => Object {
594-
"charLength": 292,
595-
"charOffset": 241,
596-
},
597-
541 => Object {
598-
"charLength": 383,
599-
"charOffset": 547,
600-
},
601-
},
552+
"positionByModuleId": Map {},
602553
},
603554
"async-2.js" => Object {
604-
"positionByModuleId": Map {
605-
454 => Object {
606-
"charLength": 280,
607-
"charOffset": 241,
608-
},
609-
541 => Object {
610-
"charLength": 375,
611-
"charOffset": 535,
612-
},
613-
},
555+
"positionByModuleId": Map {},
614556
},
615557
},
616558
"byModule": Map {
@@ -630,23 +572,75 @@ Object {
630572
631573
exports[`ModuleMinifierPlugin Handles multiple runtimes (mock): Warnings 1`] = `Array []`;
632574
633-
exports[`ModuleMinifierPlugin Handles multiple runtimes (terser): Content 1`] = `Object {}`;
634-
635-
exports[`ModuleMinifierPlugin Handles multiple runtimes (terser): Errors 1`] = `
636-
Array [
637-
Object {
638-
"message": "Unexpected token name «__WEBPACK_CHUNK_MODULE__522ee27cac2edf706f26b73b1e5ec4bc44feefe1107c5e303f671547dff3b8d1», expected punc «,»",
639-
},
640-
Object {
641-
"message": "Unexpected token name «__WEBPACK_CHUNK_MODULE__9fa9db01a39f213b0bad42889493581d8a3cc9d76f3b77543aa34e2cfc6622ed», expected punc «,»",
642-
},
643-
]
575+
exports[`ModuleMinifierPlugin Handles multiple runtimes (terser): Content 1`] = `
576+
Object {
577+
"/release/async-1.js": "/*! For license information please see async-1.js.LICENSE.txt */
578+
\\"use strict\\";(self.webpackChunk=self.webpackChunk||[]).push([[527],{923(){(e,t,n){function a(){console.log(\\"async-1\\")}n.d(t,{async1:()=>a})}
579+
},541(){(e,t,n){n.d(t,{async1:()=>a.async1});var a=n(923)}
580+
}}]);",
581+
"/release/async-1.js.LICENSE.txt": "// @license BAR
582+
// @license MIT
583+
",
584+
"/release/async-2.js": "/*! For license information please see async-2.js.LICENSE.txt */
585+
\\"use strict\\";(self.webpackChunk=self.webpackChunk||[]).push([[324],{454(){(e,t,n){function a(){console.log(\\"async-2\\")}n.d(t,{a2:()=>a})}
586+
},541(){(e,t,n){n.d(t,{a2:()=>a.a2});var a=n(454)}
587+
}}]);",
588+
"/release/async-2.js.LICENSE.txt": "// @license BAZ
589+
// @license MIT
590+
",
591+
"/release/entry1.js": "(()=>{var e,t={},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,a),r.exports}a.m=t,a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>\\"async-1.js\\",a.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},a.l=(t,n,i,r)=>{if(e[t])e[t].push(n);else{var o,s;if(void 0!==i)for(var c=document.getElementsByTagName(\\"script\\"),d=0;d<c.length;d++){var l=c[d];if(l.getAttribute(\\"src\\")==t){o=l;break}}o||(s=!0,(o=document.createElement(\\"script\\")).charset=\\"utf-8\\",a.nc&&o.setAttribute(\\"nonce\\",a.nc),o.src=t),e[t]=[n];var u=(n,a)=>{o.onerror=o.onload=null,clearTimeout(f);var i=e[t];if(delete e[t],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(a)),n)return n(a)},f=setTimeout(u.bind(null,void 0,{type:\\"timeout\\",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),s&&document.head.appendChild(o)}},(()=>{var e;a.g.importScripts&&(e=a.g.location+\\"\\");var t=a.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName(\\"script\\");if(n.length)for(var i=n.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=n[i--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),a.p=e})(),(()=>{var e={834:0};a.f.j=(t,n)=>{var i=a.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise((n,a)=>i=e[t]=[n,a]);n.push(i[2]=r);var o=a.p+a.u(t),s=new Error;a.l(o,n=>{if(a.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&(\\"load\\"===n.type?\\"missing\\":n.type),o=n&&n.target&&n.target.src;s.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+r+\\": \\"+o+\\")\\",s.name=\\"ChunkLoadError\\",s.type=r,s.request=o,i[1](s)}},\\"chunk-\\"+t,t)}};var t=(t,n)=>{var i,r,[o,s,c]=n,d=0;if(o.some(t=>0!==e[t])){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);if(c)c(a)}for(t&&t(n);d<o.length;d++)r=o[d],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),console.log(\\"Do stuff\\"),a.e(527).then(a.bind(a,541)).then(e=>e.async1()),a.e(527).then(a.bind(a,923)).then(e=>e.async1())})();",
592+
"/release/entry2.js": "(()=>{var e,t={},n={};function a(e){var i=n[e];if(void 0!==i)return i.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,a),r.exports}a.m=t,a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>\\"async-2.js\\",a.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},a.l=(t,n,i,r)=>{if(e[t])e[t].push(n);else{var o,s;if(void 0!==i)for(var c=document.getElementsByTagName(\\"script\\"),d=0;d<c.length;d++){var l=c[d];if(l.getAttribute(\\"src\\")==t){o=l;break}}o||(s=!0,(o=document.createElement(\\"script\\")).charset=\\"utf-8\\",a.nc&&o.setAttribute(\\"nonce\\",a.nc),o.src=t),e[t]=[n];var u=(n,a)=>{o.onerror=o.onload=null,clearTimeout(f);var i=e[t];if(delete e[t],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(a)),n)return n(a)},f=setTimeout(u.bind(null,void 0,{type:\\"timeout\\",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),s&&document.head.appendChild(o)}},(()=>{var e;a.g.importScripts&&(e=a.g.location+\\"\\");var t=a.g.document;if(!e&&t&&(t.currentScript&&\\"SCRIPT\\"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName(\\"script\\");if(n.length)for(var i=n.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=n[i--].src}if(!e)throw new Error(\\"Automatic publicPath is not supported in this browser\\");e=e.replace(/^blob:/,\\"\\").replace(/#.*$/,\\"\\").replace(/\\\\?.*$/,\\"\\").replace(/\\\\/[^\\\\/]+$/,\\"/\\"),a.p=e})(),(()=>{var e={441:0};a.f.j=(t,n)=>{var i=a.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise((n,a)=>i=e[t]=[n,a]);n.push(i[2]=r);var o=a.p+a.u(t),s=new Error;a.l(o,n=>{if(a.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&(\\"load\\"===n.type?\\"missing\\":n.type),o=n&&n.target&&n.target.src;s.message=\\"Loading chunk \\"+t+\\" failed.\\\\n(\\"+r+\\": \\"+o+\\")\\",s.name=\\"ChunkLoadError\\",s.type=r,s.request=o,i[1](s)}},\\"chunk-\\"+t,t)}};var t=(t,n)=>{var i,r,[o,s,c]=n,d=0;if(o.some(t=>0!==e[t])){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);if(c)c(a)}for(t&&t(n);d<o.length;d++)r=o[d],a.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),console.log(\\"Do stuff\\"),a.e(324).then(a.bind(a,541)).then(e=>e.a2()),a.e(324).then(a.bind(a,454)).then(e=>e.a2())})();",
593+
}
644594
`;
645595
596+
exports[`ModuleMinifierPlugin Handles multiple runtimes (terser): Errors 1`] = `Array []`;
597+
646598
exports[`ModuleMinifierPlugin Handles multiple runtimes (terser): Metadata 1`] = `
647599
Object {
648-
"byAssetFilename": Map {},
649-
"byModule": Map {},
600+
"byAssetFilename": Map {
601+
"entry1.js" => Object {
602+
"positionByModuleId": Map {},
603+
},
604+
"entry2.js" => Object {
605+
"positionByModuleId": Map {},
606+
},
607+
"async-1.js" => Object {
608+
"positionByModuleId": Map {
609+
923 => Object {
610+
"charLength": 66,
611+
"charOffset": 139,
612+
},
613+
541 => Object {
614+
"charLength": 50,
615+
"charOffset": 214,
616+
},
617+
},
618+
},
619+
"async-2.js" => Object {
620+
"positionByModuleId": Map {
621+
454 => Object {
622+
"charLength": 62,
623+
"charOffset": 139,
624+
},
625+
541 => Object {
626+
"charLength": 42,
627+
"charOffset": 210,
628+
},
629+
},
630+
},
631+
},
632+
"byModule": Map {
633+
923 => Map {
634+
527 => 66,
635+
},
636+
541 => Map {
637+
527 => 50,
638+
324 => 42,
639+
},
640+
454 => Map {
641+
324 => 62,
642+
},
643+
},
650644
}
651645
`;
652646

0 commit comments

Comments
 (0)