diff --git a/lib/chunksorter.js b/lib/chunksorter.js index 8c5faf1..584e01c 100644 --- a/lib/chunksorter.js +++ b/lib/chunksorter.js @@ -1,6 +1,7 @@ 'use strict'; var toposort = require('toposort'); +var _ = require('lodash'); /* Sorts dependencies between chunks by their "parents" attribute. @@ -40,7 +41,8 @@ module.exports.dependency = function (chunks) { if (chunk.parents) { // Add an edge for each parent (parent -> child) chunk.parents.forEach(function (parentId) { - var parentChunk = nodeMap[parentId]; + // webpack2 chunk.parents are chunks instead of string id(s) + var parentChunk = _.isObject(parentId) ? parentId : nodeMap[parentId]; // If the parent chunk does not exist (e.g. because of an excluded chunk) // we ignore that parent if (parentChunk) {