Unverified Commit 4d940d35 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Clean module path if Fast Refresh full reload was caused by files outside project (#76108)

parent 0287e106
......@@ -524,9 +524,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
if (file) {
// `file` is filepath in `pages/` but it can be a webpack url.
// If it's a webpack loader URL, it will include the app-pages layer
if (
file.startsWith(`(${WEBPACK_LAYERS.appPagesBrowser})/./`)
) {
if (file.startsWith(`(${WEBPACK_LAYERS.appPagesBrowser})/`)) {
const fileUrl = new URL(file, 'file://')
const cwd = process.cwd()
const modules = fileUrl.searchParams
......@@ -541,7 +539,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
}
} else if (
// Handle known webpack layers
file.startsWith(`(${WEBPACK_LAYERS.pagesDirBrowser})/./`)
file.startsWith(`(${WEBPACK_LAYERS.pagesDirBrowser})/`)
) {
const cleanedFilePath = file.slice(
`(${WEBPACK_LAYERS.pagesDirBrowser})/`.length
......
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