diff options
Diffstat (limited to 'node_modules/html-webpack-plugin/lib')
-rw-r--r-- | node_modules/html-webpack-plugin/lib/chunksorter.js | 24 | ||||
-rw-r--r-- | node_modules/html-webpack-plugin/lib/loader.js | 2 |
2 files changed, 24 insertions, 2 deletions
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 @@ -81,6 +81,28 @@ module.exports.none = function (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. */ module.exports.auto = module.exports.id; @@ -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; } |