Unverified Commit 6639b8f2 authored by Luis Alvarez D's avatar Luis Alvarez D Committed by GitHub

Find pages/_document.js chunk in development (#15172)

Chunks already have a normalized path.

Not sure if there are other chunks that require this change, I did a global search and didn't find similar cases.
parent 29dfaf9c
...@@ -2,7 +2,7 @@ import { getOverlayMiddleware } from '@next/react-dev-overlay/lib/middleware' ...@@ -2,7 +2,7 @@ import { getOverlayMiddleware } from '@next/react-dev-overlay/lib/middleware'
import { NextHandleFunction } from 'connect' import { NextHandleFunction } from 'connect'
import { IncomingMessage, ServerResponse } from 'http' import { IncomingMessage, ServerResponse } from 'http'
import { WebpackHotMiddleware } from './hot-middleware' import { WebpackHotMiddleware } from './hot-middleware'
import { join, normalize, relative as relativePath } from 'path' import { join, relative as relativePath } from 'path'
import { UrlObject } from 'url' import { UrlObject } from 'url'
import webpack from 'webpack' import webpack from 'webpack'
import { createEntrypoints, createPagesMapping } from '../build/entries' import { createEntrypoints, createPagesMapping } from '../build/entries'
...@@ -353,7 +353,7 @@ export default class HotReloader { ...@@ -353,7 +353,7 @@ export default class HotReloader {
// We only watch `_document` for changes on the server compilation // We only watch `_document` for changes on the server compilation
// the rest of the files will be triggered by the client compilation // the rest of the files will be triggered by the client compilation
const documentChunk = compilation.chunks.find( const documentChunk = compilation.chunks.find(
(c) => c.name === normalize(`pages/_document`) (c) => c.name === `pages/_document`
) )
// If the document chunk can't be found we do nothing // If the document chunk can't be found we do nothing
if (!documentChunk) { if (!documentChunk) {
......
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