1
0
Fork 0
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:
Tim Neutkens 2019-01-21 22:39:39 +01:00 committed by GitHub
parent b20b371a41
commit 2a50c176cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -216,7 +216,6 @@ function processMessage (e) {
if (obj.warnings.length > 0) {
handleWarnings(obj.warnings)
break
}
if (obj.errors.length > 0) {

View file

@ -1,6 +1,15 @@
const path = require('path')
module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60
},
webpack (config) {
config.module.rules.push({
test: /pages[\\/]hmr/,
loader: path.join(__dirname, 'warning-loader.js')
})
return config
}
}

View 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
}