Skip to content

Commit

Permalink
fix GlobalError interop and add test case (#49033)
Browse files Browse the repository at this point in the history
### What?

fixes handling of GlobalError interop
adds a test case for client component bug

### Why?

app dir client component interop is broken

### Turbopack changes

* vercel/turborepo#4597 <!-- Tobias Koppers - add
rspack to our benchmark suite -->
* vercel/turborepo#4761 <!-- Tobias Koppers - Do not
use interop logic on proxy modules -->
  • Loading branch information
sokra authored May 1, 2023
1 parent 3362851 commit dbccc79
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 49 deletions.
66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ swc_relay = { version = "0.2.7" }
testing = { version = "0.33.6" }

# Turbo crates
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.2" }
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.3" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.3" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230501.3" }

# General Deps

Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230501.2",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230501.2",
"@vercel/turbopack-dev": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230501.3",
"@vercel/turbopack-node": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-node/js?turbopack-230501.3",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function RootLayout({ children }: { children: any }) {
return (
<html>
<body>{children}</body>
</html>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Test } from './test'

export default function Page() {
return (
<div>
<Test />
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use client'

import { useEffect } from 'react'

export function Test() {
useEffect(() => {
import('@turbo/pack-test-harness').then(() => {
it('should allow to import a named export from a client component', () => {})
})
return () => {}
}, [])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
experimental: {
appDir: true,
},
}
3 changes: 1 addition & 2 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1204,10 +1204,9 @@ export async function renderToHTMLOrFlight(
const AppRouter =
ComponentMod.AppRouter as typeof import('../../client/components/app-router').default

const GlobalError = interopDefault(
const GlobalError =
/** GlobalError can be either the default error boundary or the overwritten app/global-error.js **/
ComponentMod.GlobalError as typeof import('../../client/components/error-boundary').default
)

let serverComponentsInlinedTransformStream: TransformStream<
Uint8Array,
Expand Down
Loading

0 comments on commit dbccc79

Please sign in to comment.