Skip to content

Next.js

Works with both bundlers — Turbopack (the default from Next 16) and next build --webpack.

sh
npm install --save-dev @hozo/next @hozo/compilernpm install @hozo/core
ts
// next.config.tsimport { withHozo } from '@hozo/next'export default withHozo({ /* your Next config */ }, { css: 'src/theme.css' })

create-next-app writes const nextConfig = { … } and exports it; wrap that export, export default withHozo(nextConfig, { … }), and keep the rest.

Pass css even when the default would find something. create-next-app’s app/globals.css is on the list Hozo looks for, and without Tailwind it holds no @import "tailwindcss": Hozo would read it, find no theme, and compile against Tailwind’s defaults. Point css at a stylesheet that has the import, as the Vite guide’s src/theme.css does.

Install @hozo/ui and add @import "@hozo/ui/theme.css"; after Tailwind in the stylesheet passed to withHozo. The integration adds source-distributed Hozo packages such as @hozo/ui to Next’s transpilePackages automatically. In your tsconfig.json, set compilerOptions.allowImportingTsExtensions to true so TypeScript can read the package’s source imports.

Use a 'use client' component to import interactive UI from @hozo/ui. You can render that client component from a server page or layout.

If the project was created with Tailwind, app/globals.css already imports it and @tailwindcss/postcss already emits Tailwind’s preflight. Use that stylesheet, and turn Hozo’s preflight off so the page gets one copy:

ts
export default withHozo(nextConfig, { css: 'app/globals.css', preflight: false })