Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix next-app-loader bug in windows #41520

Merged
merged 2 commits into from Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/next/build/webpack/loaders/next-app-loader.ts
Expand Up @@ -2,6 +2,7 @@ import type webpack from 'webpack'
import type { ValueOf } from '../../../shared/lib/constants'
import { NODE_RESOLVE_OPTIONS } from '../../webpack-config'
import { getModuleBuildInfo } from './get-module-build-info'
import { sep } from 'path'

export const FILE_TYPES = {
layout: 'layout',
Expand Down Expand Up @@ -114,7 +115,12 @@ async function createTreeCodeFromPath({
}

function createAbsolutePath(appDir: string, pathToTurnAbsolute: string) {
return pathToTurnAbsolute.replace(/^private-next-app-dir/, appDir)
return (
pathToTurnAbsolute
// Replace all POSIX path separators with the current OS path separator
.replace(/\//g, sep)
.replace(/^private-next-app-dir/, appDir)
)
}

const nextAppLoader: webpack.LoaderDefinitionFunction<{
Expand Down