From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/html-webpack-plugin/index.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'node_modules/html-webpack-plugin/index.js') diff --git a/node_modules/html-webpack-plugin/index.js b/node_modules/html-webpack-plugin/index.js index 40633a68b..f98abce2d 100644 --- a/node_modules/html-webpack-plugin/index.js +++ b/node_modules/html-webpack-plugin/index.js @@ -144,7 +144,6 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) { .then(function (result) { var html = result.html; var assets = result.assets; - var chunks = result.chunks; // Prepare script and link tags var assetTags = self.generateAssetTags(assets); var pluginArgs = {head: assetTags.head, body: assetTags.body, plugin: self, chunks: chunks, outputName: self.childCompilationOutputName}; @@ -345,7 +344,7 @@ HtmlWebpackPlugin.prototype.sortChunks = function (chunks, sortMode) { } // Check if the given sort mode is a valid chunkSorter sort mode if (typeof chunkSorter[sortMode] !== 'undefined') { - return chunkSorter[sortMode](chunks); + return chunkSorter[sortMode](chunks, this.options.chunks); } throw new Error('"' + sortMode + '" is not a valid chunk sort mode'); }; @@ -361,7 +360,11 @@ HtmlWebpackPlugin.prototype.filterChunks = function (chunks, includedChunks, exc return false; } // Skip if the chunk should be lazy loaded - if (!chunk.initial) { + if (typeof chunk.isInitial === 'function') { + if (!chunk.isInitial()) { + return false; + } + } else if (!chunk.initial) { return false; } // Skip if the chunks should be filtered and the given chunk was not added explicity @@ -385,12 +388,12 @@ HtmlWebpackPlugin.prototype.isHotUpdateCompilation = function (assets) { HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chunks) { var self = this; - var webpackStatsJson = compilation.getStats().toJson(); + var compilationHash = compilation.hash; // Use the configured public path or build a relative path var publicPath = typeof compilation.options.output.publicPath !== 'undefined' // If a hard coded public path exists use it - ? compilation.mainTemplate.getPublicPath({hash: webpackStatsJson.hash}) + ? compilation.mainTemplate.getPublicPath({hash: compilationHash}) // If no public path was set get a relative url path : path.relative(path.resolve(compilation.options.output.path, path.dirname(self.childCompilationOutputName)), compilation.options.output.path) .split(path.sep).join('/'); @@ -416,8 +419,8 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu // Append a hash for cache busting if (this.options.hash) { - assets.manifest = self.appendHash(assets.manifest, webpackStatsJson.hash); - assets.favicon = self.appendHash(assets.favicon, webpackStatsJson.hash); + assets.manifest = self.appendHash(assets.manifest, compilationHash); + assets.favicon = self.appendHash(assets.favicon, compilationHash); } for (var i = 0; i < chunks.length; i++) { @@ -434,7 +437,7 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu // Append a hash for cache busting if (this.options.hash) { chunkFiles = chunkFiles.map(function (chunkFile) { - return self.appendHash(chunkFile, webpackStatsJson.hash); + return self.appendHash(chunkFile, compilationHash); }); } @@ -522,8 +525,8 @@ HtmlWebpackPlugin.prototype.generateAssetTags = function (assets) { */ HtmlWebpackPlugin.prototype.injectAssetsIntoHtml = function (html, assets, assetTags) { var htmlRegExp = /(]*>)/i; - var headRegExp = /(<\/head>)/i; - var bodyRegExp = /(<\/body>)/i; + var headRegExp = /(<\/head\s*>)/i; + var bodyRegExp = /(<\/body\s*>)/i; var body = assetTags.body.map(this.createHtmlTag); var head = assetTags.head.map(this.createHtmlTag); -- cgit v1.2.3