[async] make sure the async chunks aren't included in the html
This commit is contained in:
parent
1f5b357159
commit
0d727cc23e
5
index.js
5
index.js
|
|
@ -206,6 +206,11 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function(compilation, webp
|
|||
var chunk = chunks[i];
|
||||
var chunkName = chunk.names[0];
|
||||
|
||||
// This chunk doesn't have a name. This script can't handled it.
|
||||
if(chunkName === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if the chunks should be filtered and the given chunk was not added explicity
|
||||
if (Array.isArray(includedChunks) && includedChunks.indexOf(chunkName) === -1) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ function testHtmlPlugin(webpackConfig, expectedResults, outputFile, done, expect
|
|||
expect(compilationWarnings).not.toBe('');
|
||||
} else {
|
||||
expect(compilationWarnings).toBe('');
|
||||
}
|
||||
}
|
||||
var htmlContent = fs.readFileSync(path.join(OUTPUT_DIR, outputFile)).toString();
|
||||
|
||||
for (var i = 0; i < expectedResults.length; i++) {
|
||||
var expectedResult = expectedResults[i];
|
||||
if (expectedResult instanceof RegExp) {
|
||||
|
|
@ -50,7 +51,7 @@ describe('HtmlWebpackPlugin', function() {
|
|||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin()]
|
||||
}, ['<script src="index_bundle.js"'], null, done);
|
||||
}, [/<body>[\s]*<script src="index_bundle.js"><\/script>[\s]*<\/body>/], null, done);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "async";
|
||||
|
|
@ -1,2 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
require('./common');
|
||||
|
||||
require.ensure([], function() {
|
||||
require('./async');
|
||||
});
|
||||
|
||||
document.body.innerHTML = document.body.innerHTML + "<p>index.js</p>";
|
||||
|
|
|
|||
Loading…
Reference in New Issue