Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit e9b52b6

Browse files
sis0k0DimitarTachev
authored andcommitted
chore: apply PR suggestions
1 parent be82ab7 commit e9b52b6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Diff for: plugins/WatchStateLoggerPlugin.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class WatchStateLoggerPlugin {
3131
console.log(messages.compilationComplete);
3232
}
3333

34-
const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles(compilation, compiler);
34+
const runtimeOnlyFiles = getWebpackRuntimeOnlyFiles(compilation, compiler.context);
3535
let emittedFiles = Object
3636
.keys(compilation.assets)
3737
.filter(assetKey => compilation.assets[assetKey].emitted);
@@ -48,19 +48,18 @@ export class WatchStateLoggerPlugin {
4848
}
4949
}
5050

51-
function getWebpackRuntimeOnlyFiles(compilation, compiler) {
51+
function getWebpackRuntimeOnlyFiles(compilation, basePath) {
5252
let runtimeOnlyFiles = [];
5353
try {
54-
runtimeOnlyFiles = [].concat(...compilation.chunkGroups
55-
// get the chunk group of each entry points (e.g. main.js and inspector-modules.js)
56-
.map(chunkGroup => chunkGroup.runtimeChunk)
54+
runtimeOnlyFiles = [].concat(...Array.from<any>(compilation.entrypoints.values())
55+
.map(entrypoint => entrypoint.runtimeChunk)
5756
// filter embedded runtime chunks (e.g. part of bundle.js or inspector-modules.js)
58-
.filter(runtimeChunk => runtimeChunk.preventIntegration)
57+
.filter(runtimeChunk => !!runtimeChunk && runtimeChunk.preventIntegration)
5958
.map(runtimeChunk => runtimeChunk.files))
6059
// get only the unique files in case of "single" runtime (e.g. runtime.js)
6160
.filter((value, index, self) => self.indexOf(value) === index)
6261
// convert to absolute paths
63-
.map(fileName => join(compiler.context, fileName));
62+
.map(fileName => join(basePath, fileName));
6463
} catch (e) {
6564
// breaking change in the Webpack API
6665
console.log("Warning: Unable to find Webpack runtime files.");

0 commit comments

Comments
 (0)