-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Turbopack] fix root and project path usages in a monorepo (#73552)
### What? Improved trace source maps to return relative paths and always relative to process.cwd. `turbopack://` urls in SourceMaps are always relative to the project root. `file://` urls do no longer contain duplicate path segments. Add a test case Also: * improve error when sourcemap lookup throws
- Loading branch information
Showing
35 changed files
with
531 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ReactNode } from 'react' | ||
export default function Root({ children }: { children: ReactNode }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/monorepo-package-rsc/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { text } from 'my-package/typescript' | ||
|
||
export default function Page() { | ||
return <p>{text}</p> | ||
} |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/monorepo-package-ssr/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client' | ||
|
||
import { text } from 'my-package/typescript' | ||
|
||
export default function Page() { | ||
return <p>{text}</p> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/separate-file.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
throw new Error('Expected error') |
18 changes: 18 additions & 0 deletions
18
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/source-maps-client/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use client' | ||
|
||
import { useEffect } from 'react' | ||
|
||
export default function Page() { | ||
useEffect(function effectCallback() { | ||
innerFunction() | ||
}) | ||
return <p>Hello Source Maps</p> | ||
} | ||
|
||
function innerFunction() { | ||
innerArrowFunction() | ||
} | ||
|
||
const innerArrowFunction = () => { | ||
require('../separate-file') | ||
} |
15 changes: 15 additions & 0 deletions
15
test/e2e/app-dir/non-root-project-monorepo/apps/web/app/source-maps-rsc/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default async function Page({ searchParams }) { | ||
// We don't want the build to fail in production | ||
if (process.env.NODE_ENV === 'development') { | ||
innerFunction() | ||
} | ||
return <p>Hello Source Maps</p> | ||
} | ||
|
||
function innerFunction() { | ||
innerArrowFunction() | ||
} | ||
|
||
const innerArrowFunction = () => { | ||
require('../separate-file') | ||
} |
Oops, something went wrong.