mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
These scopes aren't fully Next.js environments and can't access many Next.js APIs. In the future this might change but for now we will exclude the `next-js` condition when bundling for these entrypoints so that 3rd parties that target Next.js can do so with the expectation that regardless of what environment they are running in the full suite of Next.js libraries they support will work.
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
// For this to work locally you need to use `pnpm next-with-deps dev|build`
|
|
// Make sure you delete node_modules if you are editing the package otherwise it won't
|
|
// reinstall and reflect your changes.
|
|
|
|
import ExportsDefault from 'my-external-cjs-package/exports'
|
|
import * as ExportsNamed from 'my-external-cjs-package/exports'
|
|
import { named as namedExports } from 'my-external-cjs-package/exports'
|
|
|
|
import ImportsDefault from 'my-external-cjs-package/imports'
|
|
import * as ImportsNamed from 'my-external-cjs-package/imports'
|
|
import { named as namedImports } from 'my-external-cjs-package/imports'
|
|
|
|
const pendingDynamicExports = import('my-external-cjs-package/exports').then(
|
|
(mod) => JSON.stringify(mod)
|
|
)
|
|
|
|
const pendingDynamicImports = import('my-external-cjs-package/imports').then(
|
|
(mod) => JSON.stringify(mod)
|
|
)
|
|
|
|
import Client from './client'
|
|
|
|
export default function Page() {
|
|
return (
|
|
<>
|
|
<section>
|
|
<h2>Server</h2>
|
|
<section>
|
|
<h3>Exports</h3>
|
|
<section>
|
|
<h4>Static</h4>
|
|
<label>Default:</label>
|
|
<div>{JSON.stringify(ExportsDefault)}</div>
|
|
<label>Namespace:</label>
|
|
<div>{JSON.stringify(ExportsNamed)}</div>
|
|
<label>named:</label>
|
|
<div>{JSON.stringify(namedExports)}</div>
|
|
</section>
|
|
<section>
|
|
<h4>Dynamic</h4>
|
|
<div>{pendingDynamicExports}</div>
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>Imports</h3>
|
|
<section>
|
|
<h4>Static</h4>
|
|
<label>Default:</label>
|
|
<div>{JSON.stringify(ImportsDefault)}</div>
|
|
<label>Namespace:</label>
|
|
<div>{JSON.stringify(ImportsNamed)}</div>
|
|
<label>named:</label>
|
|
<div>{JSON.stringify(namedImports)}</div>
|
|
</section>
|
|
<section>
|
|
<h4>Dynamic</h4>
|
|
<div>{pendingDynamicImports}</div>
|
|
</section>
|
|
</section>
|
|
</section>
|
|
<Client />
|
|
</>
|
|
)
|
|
}
|