mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
dba20c3d16
Analogous to https://github.com/vercel/next.js/pull/15145, this adds no-op stubs to take the place of the react refresh runtime in workers. This prevents workers from failing when they use react components, such as in non-dom react renderers like [`@react-three/offscreen`](https://github.com/pmndrs/react-three-offscreen). This code is only added in dev, and the base runtime was parameterized to allow this. Test Plan: - Manually create a worker that uses `@react-three/offscreen` to render a component and use it in dev. - [x] Automated test
12 lines
225 B
TypeScript
12 lines
225 B
TypeScript
'use client'
|
|
|
|
import { useEffect } from 'react'
|
|
|
|
export default function ClientComponent() {
|
|
useEffect(() => {
|
|
new Worker(new URL('./worker.tsx', import.meta.url))
|
|
}, [])
|
|
|
|
return <p>This is a client component</p>
|
|
}
|