Skip to content

Commit f9a0799

Browse files
committed
Fixing a bug where runtime.js would appear for "style" entries in
entrypoints.json
1 parent 9d2043c commit f9a0799

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/plugins/entry-files-manifest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ module.exports = function(plugins, webpackConfig) {
2424
plugins.push({
2525
plugin: new EntryFilesManifestPlugin(
2626
path.join(webpackConfig.outputPath, 'entrypoints.json'),
27-
[sharedEntryTmpName]
27+
[sharedEntryTmpName],
28+
webpackConfig.styleEntries
2829
),
2930
priority: PluginPriorities.DeleteUnusedEntriesJSPlugin
3031
});

lib/webpack/entry-files-manifest-plugin.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
const logger = require('../logger');
1313
const fse = require('fs-extra');
1414

15-
function EntryFilesManifestPlugin(manifestFilename, entryNamesToSkip) {
15+
function EntryFilesManifestPlugin(manifestFilename, entryNamesToSkip, styleEntriesMap) {
1616
this.manifestFilename = manifestFilename;
1717
this.entryNamesToSkip = entryNamesToSkip;
18+
this.styleEntriesMap = styleEntriesMap;
1819
}
1920

2021
/**
@@ -61,11 +62,18 @@ EntryFilesManifestPlugin.prototype.apply = function(compiler) {
6162
return;
6263
}
6364

64-
const { cssChunkIds, jsChunkIds } = extractChunkIds(entry);
65+
let { cssChunkIds, jsChunkIds } = extractChunkIds(entry);
66+
67+
// for style entries, there are no js files
68+
// this makes sure runtime.js is not included
69+
if (this.styleEntriesMap.has(entryName)) {
70+
jsChunkIds = [];
71+
}
6572

6673
// look up the original chunk name by id
6774
const cssChunkNames = cssChunkIds.map(chunkId => getChunkNameFromId(stats.compilation.chunks, chunkId));
6875
const jsChunkNames = jsChunkIds.map(chunkId => getChunkNameFromId(stats.compilation.chunks, chunkId));
76+
6977
const cssFiles = convertChunkNamesToFilenames(cssChunkNames, 'css');
7078
const jsFiles = convertChunkNamesToFilenames(jsChunkNames, 'js');
7179

0 commit comments

Comments
 (0)