From c54273563aa82aa823cacda3fcaee76c62aebef8 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 9 Jun 2016 20:35:45 +0200 Subject: [PATCH] Exclude chunks works now even if combined with dependency sort --- CHANGELOG.md | 4 ++++ lib/chunksorter.js | 7 ++++--- package.json | 2 +- spec/BasicSpec.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e77a578..3c2269c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Change History ============== +v2.20.0 +---- +* Exclude chunks works now even if combined with dependency sort + v2.19.0 ---- * Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation diff --git a/lib/chunksorter.js b/lib/chunksorter.js index fc41ae5..8c5faf1 100644 --- a/lib/chunksorter.js +++ b/lib/chunksorter.js @@ -41,10 +41,11 @@ module.exports.dependency = function (chunks) { // Add an edge for each parent (parent -> child) chunk.parents.forEach(function (parentId) { var parentChunk = nodeMap[parentId]; - if (!parentChunk) { - throw new Error('Can not find chunk parent during dependency sort'); + // If the parent chunk does not exist (e.g. because of an excluded chunk) + // we ignore that parent + if (parentChunk) { + edges.push([parentChunk, chunk]); } - edges.push([parentChunk, chunk]); }); } }); diff --git a/package.json b/package.json index f5ab2e3..e61e341 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-webpack-plugin", - "version": "2.19.0", + "version": "2.20.0", "description": "Simplifies creation of HTML files to serve your webpack bundles", "main": "index.js", "files": [ diff --git a/spec/BasicSpec.js b/spec/BasicSpec.js index b43ad53..9034081 100644 --- a/spec/BasicSpec.js +++ b/spec/BasicSpec.js @@ -1163,6 +1163,35 @@ describe('HtmlWebpackPlugin', function () { /