Remove bugfix needed for webpack 4 when webpack 5 is used (#23886)

Tobias has fixed the `compiler.hooks.invalid.call()` bug in webpack 5 so this is no longer needed



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
This commit is contained in:
Tim Neutkens 2021-04-11 17:06:35 +02:00 committed by GitHub
parent 2c2ac2e868
commit 2b48670bd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

1
.vscode/launch.json vendored
View file

@ -12,6 +12,7 @@
"runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "dev", "test/integration/basic"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"port": 9229
},
{

View file

@ -2,7 +2,7 @@ import { EventEmitter } from 'events'
import { IncomingMessage, ServerResponse } from 'http'
import { join, posix } from 'path'
import { parse } from 'url'
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { webpack, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import * as Log from '../build/output/log'
import {
normalizePagePath,
@ -293,12 +293,14 @@ class Invalidator {
}
this.building = true
// Work around a bug in webpack, calling `invalidate` on Watching.js
// doesn't trigger the invalid call used to keep track of the `.done` hook on multiCompiler
for (const compiler of this.multiCompiler.compilers) {
// @ts-ignore TODO: Check if this is still needed with webpack 5
compiler.hooks.invalid.call()
if (!isWebpack5) {
// Work around a bug in webpack, calling `invalidate` on Watching.js
// doesn't trigger the invalid call used to keep track of the `.done` hook on multiCompiler
for (const compiler of this.multiCompiler.compilers) {
compiler.hooks.invalid.call()
}
}
this.watcher.invalidate()
}