Fix chunk filtering
This commit is contained in:
parent
e52bf5e2f3
commit
ed8f61fc69
6
index.js
6
index.js
|
|
@ -89,7 +89,7 @@ HtmlWebpackPlugin.prototype.didChunkFilesChange = function(chunks) {
|
|||
var files = _.flatten(chunks.map(function(chunk) {
|
||||
return chunk.files;
|
||||
}));
|
||||
if(_.difference(files, this.filesOfLastRun).length > 0) {
|
||||
if(!this.filesOfLastRun || _.difference(files, this.filesOfLastRun).length > 0) {
|
||||
this.filesOfLastRun = files;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -248,9 +248,9 @@ HtmlWebpackPlugin.prototype.addFileToAssets = function(filename, compilation) {
|
|||
*/
|
||||
HtmlWebpackPlugin.prototype.filterChunks = function (webpackStatsJson, includedChunks, excludedChunks) {
|
||||
var chunks = webpackStatsJson.chunks.filter(function(chunk){
|
||||
var chunkName = chunk.names;
|
||||
var chunkName = chunk.names[0];
|
||||
// This chunk doesn't have a name. This script can't handled it.
|
||||
if(chunkName === undefined) {
|
||||
if (chunkName === undefined) {
|
||||
return false;
|
||||
}
|
||||
// Skip if the chunks should be filtered and the given chunk was not added explicity
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@ function testHtmlPlugin(webpackConfig, expectedResults, outputFile, done, expect
|
|||
} else {
|
||||
expect(compilationWarnings).toBe('');
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
var outputFileExists = fs.existsSync(path.join(OUTPUT_DIR, outputFile));
|
||||
expect(outputFileExists).toBe(true);
|
||||
if(!outputFileExists) {
|
||||
return done();
|
||||
}
|
||||
>>>>>>> Fix chunk filtering
|
||||
var htmlContent = fs.readFileSync(path.join(OUTPUT_DIR, outputFile)).toString();
|
||||
|
||||
for (var i = 0; i < expectedResults.length; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue