mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix windows sub-path dev rebuild failed issue. (#1930)
* Fix windows sub-path dev rebuild failed issue. * Make sure we apply the '\' replace only on windows.
This commit is contained in:
parent
c545a89fdf
commit
2f4a662a48
|
@ -12,7 +12,17 @@ export default class PagesPlugin {
|
|||
pages.forEach((chunk) => {
|
||||
const page = compilation.assets[chunk.name]
|
||||
const pageName = matchRouteName.exec(chunk.name)[1]
|
||||
const routeName = `/${pageName.replace(/[/\\]?index$/, '')}`
|
||||
let routeName = `/${pageName.replace(/[/\\]?index$/, '')}`
|
||||
|
||||
// We need to convert \ into / when we are in windows
|
||||
// to get the proper route name
|
||||
// Here we need to do windows check because it's possible
|
||||
// to have "\" in the filename in unix.
|
||||
// Anyway if someone did that, he'll be having issues here.
|
||||
// But that's something we cannot avoid.
|
||||
if (/^win/.test(process.platform)) {
|
||||
routeName = routeName.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
const content = page.source()
|
||||
const newContent = `
|
||||
|
|
Loading…
Reference in a new issue