mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Make HMR still apply updates when there is a webpack warning (#6099)
Fixes #5363 I noticed this happening when making some changes on the nextjs.org/learn app. Basically we didn't apply updates when a warning was emitted from webpack. This would cause issues for users using eslint-loader or similar too.
This commit is contained in:
parent
b20b371a41
commit
2a50c176cf
|
@ -216,7 +216,6 @@ function processMessage (e) {
|
||||||
|
|
||||||
if (obj.warnings.length > 0) {
|
if (obj.warnings.length > 0) {
|
||||||
handleWarnings(obj.warnings)
|
handleWarnings(obj.warnings)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.errors.length > 0) {
|
if (obj.errors.length > 0) {
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
|
const path = require('path')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
onDemandEntries: {
|
onDemandEntries: {
|
||||||
// Make sure entries are not getting disposed.
|
// Make sure entries are not getting disposed.
|
||||||
maxInactiveAge: 1000 * 60 * 60
|
maxInactiveAge: 1000 * 60 * 60
|
||||||
|
},
|
||||||
|
webpack (config) {
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /pages[\\/]hmr/,
|
||||||
|
loader: path.join(__dirname, 'warning-loader.js')
|
||||||
|
})
|
||||||
|
|
||||||
|
return config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
test/integration/basic/warning-loader.js
Normal file
4
test/integration/basic/warning-loader.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = function (source) {
|
||||||
|
this.emitWarning(new Error('This is an expected warning added by warning-loader.js'))
|
||||||
|
return source
|
||||||
|
}
|
Loading…
Reference in a new issue