Skip to content

Commit

Permalink
Add tests for webpack4 modules with additional entrypoint ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelStrother committed Mar 1, 2018
1 parent 1992efa commit f51c134
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parseUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function parseBundle(bundlePath) {
}

// Additional bundles with webpack 4 are loaded with:
// (window.webpackJsonp=window.webpackJsonp||[]).push([[minimum ID], <module>, <module>]);
// (window.webpackJsonp=window.webpackJsonp||[]).push([[chunkId], [<module>, <module>], [[optional_entries]]]);
if (
isWindowPropertyPushExpression(node) &&
args.length === 1 &&
Expand Down Expand Up @@ -129,6 +129,7 @@ function isArgumentContainsModulesList(arg) {
function isArgumentContainingChunkIdsAndModulesList(arg) {
if (
arg.type === 'ArrayExpression' &&
arg.elements.length >= 2 &&
isArgumentContainsChunkIds(arg.elements[0]) &&
isArgumentContainsModulesList(arg.elements[1])
) {
Expand Down
1 change: 1 addition & 0 deletions test/bundles/validWebpack4ChunkAndEntryPoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{"57iH":function(e,n,t){console.log("hello world")}},[["57iH",19,24,25]]]);
5 changes: 5 additions & 0 deletions test/bundles/validWebpack4ChunkAndEntryPoint.modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"modules": {
"57iH": "function(e,n,t){console.log(\"hello world\")}"
}
}

0 comments on commit f51c134

Please sign in to comment.