mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What We're applying react-refresh to browser layer and inject ESM or CJS helper based on file type. Some package from `trasnpilePackages` might contain CJS browser bundle. And injecting ESM helper breaks them. Actually they don't need to have fast refresh ability since they're in `node_modules`. ### How Skip react-refresh for transpiled packages as they're in node_modules and won't change. Fixes #56487 Closes NEXT-2061
24 lines
671 B
JavaScript
24 lines
671 B
JavaScript
'use client'
|
|
|
|
import getType, { named, value, array, obj } from 'non-isomorphic-text'
|
|
|
|
import add from 'transpile-ts-lib'
|
|
|
|
// ESM externals has react has a peer dependency
|
|
import useSWR from 'swr'
|
|
|
|
export default function Page() {
|
|
const { data } = useSWR('swr-state', (v) => v, { fallbackData: 'swr-state' })
|
|
return (
|
|
<div id="content">
|
|
<div>{`module type:${getType()}`}</div>
|
|
<div>{`export named:${named}`}</div>
|
|
<div>{`export value:${value}`}</div>
|
|
<div>{`export array:${array.join(',')}`}</div>
|
|
<div>{`export object:{x:${obj.x}}`}</div>
|
|
<div>{`transpilePackages:${add(2, 3)}`}</div>
|
|
<div>{data}</div>
|
|
</div>
|
|
)
|
|
}
|