From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- .../html-webpack-plugin/lib/chunksorter.js | 24 +++++++++++++++++++++- node_modules/html-webpack-plugin/lib/loader.js | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'node_modules/html-webpack-plugin/lib') diff --git a/node_modules/html-webpack-plugin/lib/chunksorter.js b/node_modules/html-webpack-plugin/lib/chunksorter.js index 584e01ccb..75f1a11a6 100644 --- a/node_modules/html-webpack-plugin/lib/chunksorter.js +++ b/node_modules/html-webpack-plugin/lib/chunksorter.js @@ -80,6 +80,28 @@ module.exports.none = function (chunks) { return chunks; }; +/** + * Sort manually by the chunks + * @param {Array} chunks the chunks to sort + * @return {Array} The sorted chunks + */ +module.exports.manual = function (chunks, specifyChunks) { + var chunksResult = []; + var filterResult = []; + if (Array.isArray(specifyChunks)) { + for (var i = 0; i < specifyChunks.length; i++) { + filterResult = chunks.filter(function (chunk) { + if (chunk.names[0] && chunk.names[0] === specifyChunks[i]) { + return true; + } + return false; + }); + filterResult.length > 0 && chunksResult.push(filterResult[0]); + } + } + return chunksResult; +}; + /** * Defines the default sorter. */ @@ -88,6 +110,6 @@ module.exports.auto = module.exports.id; // In webpack 2 the ids have been flipped. // Therefore the id sort doesn't work the same way as it did for webpack 1 // Luckily the dependency sort is working as expected -if (require('webpack/package.json').version.split('.')[0] === '2') { +if (Number(require('webpack/package.json').version.split('.')[0]) > 1) { module.exports.auto = module.exports.dependency; } diff --git a/node_modules/html-webpack-plugin/lib/loader.js b/node_modules/html-webpack-plugin/lib/loader.js index e1af5e513..6b8bd0d8e 100644 --- a/node_modules/html-webpack-plugin/lib/loader.js +++ b/node_modules/html-webpack-plugin/lib/loader.js @@ -17,7 +17,7 @@ module.exports = function (source) { return source; } // Skip .js files - if (/\.js$/.test(this.request)) { + if (/\.js$/.test(this.resourcePath)) { return source; } -- cgit v1.2.3