Unverified Commit 2b48670b authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

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
parent 2c2ac2e8
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"runtimeExecutable": "yarn", "runtimeExecutable": "yarn",
"runtimeArgs": ["run", "debug", "dev", "test/integration/basic"], "runtimeArgs": ["run", "debug", "dev", "test/integration/basic"],
"skipFiles": ["<node_internals>/**"], "skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/packages/next/dist/**/*"],
"port": 9229 "port": 9229
}, },
{ {
......
...@@ -2,7 +2,7 @@ import { EventEmitter } from 'events' ...@@ -2,7 +2,7 @@ import { EventEmitter } from 'events'
import { IncomingMessage, ServerResponse } from 'http' import { IncomingMessage, ServerResponse } from 'http'
import { join, posix } from 'path' import { join, posix } from 'path'
import { parse } from 'url' 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 * as Log from '../build/output/log'
import { import {
normalizePagePath, normalizePagePath,
...@@ -293,12 +293,14 @@ class Invalidator { ...@@ -293,12 +293,14 @@ class Invalidator {
} }
this.building = true this.building = true
// Work around a bug in webpack, calling `invalidate` on Watching.js if (!isWebpack5) {
// doesn't trigger the invalid call used to keep track of the `.done` hook on multiCompiler // Work around a bug in webpack, calling `invalidate` on Watching.js
for (const compiler of this.multiCompiler.compilers) { // doesn't trigger the invalid call used to keep track of the `.done` hook on multiCompiler
// @ts-ignore TODO: Check if this is still needed with webpack 5 for (const compiler of this.multiCompiler.compilers) {
compiler.hooks.invalid.call() compiler.hooks.invalid.call()
}
} }
this.watcher.invalidate() this.watcher.invalidate()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment