Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 874e4f8

Browse files
fix: hmr should work with uglify (#953)
Currently `hmr` with `--env.uglify` is not working as the uglifier touches all files. This leads to emit of files that are not hot updates. When CLI finds such files, it decides hmr is not successful and restarts the application. However, some of the emitted files are not actully changed. These emitted (and not changed) files are chunks of the entry points - as we are with HMR if there's an actual change for them, we'll receive hot-update files. Currently there's a logic to skip all emitted entry points and webpack runtime files (`runtime.js`) when we are with HMR. To fix the current issue, extend this logic to skip emitted chunks of entry points as well when we are with HMR and there's no hot-update for them.
1 parent 4bbf839 commit 874e4f8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎plugins/WatchStateLoggerPlugin.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ function getWebpackRuntimeOnlyFiles(compilation) {
6464
function getEntryPointFiles(compilation) {
6565
const entryPointFiles = [];
6666
try {
67-
Array.from(compilation.entrypoints.values())
67+
Array.from(compilation.entrypoints.values())
6868
.forEach((entrypoint: any) => {
69-
const entryChunk = entrypoint.chunks.find(chunk => chunk.name === entrypoint.options.name);
70-
if (entryChunk) {
69+
for (const entryChunk of entrypoint.chunks) {
7170
entryChunk.files.forEach(fileName => {
7271
if (fileName.indexOf("hot-update") === -1) {
7372
entryPointFiles.push(fileName);
@@ -79,5 +78,6 @@ function getEntryPointFiles(compilation) {
7978
console.log("Warning: Unable to find Webpack entry point files.");
8079
}
8180

82-
return entryPointFiles;
81+
return entryPointFiles
82+
.filter((value, index, self) => self.indexOf(value) === index); // get only the unique files
8383
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /