Files
zeekay 439f533458 Carry each module's client boundary into its output
esbuild compiles every entry as its own root, so a relative import is inlined
into each entry that reaches it, and the copy loses the 'use client' the
original declared. A barrel that re-exported one client component became a file
that contained it, putting a form stack and a mobx store into whichever graph
asked for the barrel. React's react-server entry has no useState, so the throw
came from whichever library checked for one.

Resolve a sibling entry as external: the output re-exports it, and both the
boundary and the dependency stay where they were written. Dist falls from 20M
to 10M. The directive now comes from the source file rather than a denylist of
output names, and the stamp walks the tree instead of the top level.
2026-08-28 20:54:00 -07:00

44 lines
1.5 KiB
JavaScript

import createMDX from '@next/mdx'
import { createRequire } from 'node:module'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
// `@hanzo/ui/next` is a build-time CommonJS module — it takes and returns a
// plain object rather than importing `next`, so it stays out of the type graph.
// It declares the settings that let a cross-platform component graph resolve on
// the web, for both bundlers at once.
const withGui = createRequire(import.meta.url)('@hanzo/ui/next')
/** @type {import('next').NextConfig} */
const nextConfig = {
// Dynamic Next.js app served by a Node server (output: 'standalone'),
// packaged as a container image — NOT a static export. This restores the
// server-rendered @luxfi/ui Header/Footer, the /checkout commerce panel,
// the lux.id auth API routes, and src/middleware.ts (device detection +
// auth). See LLM.md "Restore" notes.
output: 'standalone',
reactStrictMode: true,
transpilePackages: [
'@luxfi/data',
'@luxfi/logo',
'@luxfi/menu-icons',
'@hanzo/auth',
],
typescript: {
ignoreBuildErrors: true,
},
images: {
remotePatterns: [
{ protocol: 'https', hostname: 'cdn.lux.network', pathname: '**' },
{ protocol: 'https', hostname: 'img.youtube.com', pathname: '**' },
],
},
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
}
const withMDX = createMDX({
extension: /\.mdx?$/,
})
export default withMDX(withGui(nextConfig, dirname(fileURLToPath(import.meta.url))))