npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mochi-css/next

v6.0.1

Published

This package is part of the [Mochi-CSS project](https://github.com/Niikelion/mochi-css). It integrates compile-time CSS-in-JS into your Next.js builds.

Readme

🧁 Mochi-CSS/next

This package is part of the Mochi-CSS project. It integrates compile-time CSS-in-JS into your Next.js builds.

Installation

npm i @mochi-css/vanilla @mochi-css/react
npm i -D @mochi-css/postcss @mochi-css/next

@mochi-css/builder and @mochi-css/config install transitively and do not need to be listed explicitly.


How It Works

  1. The PostCSS plugin extracts styles from your source files and generates CSS.
  2. The Next.js loader reads the style manifest if the postcss plugin generated one and injects import to in-flight generated CSS modules.

Setup

1. mochi.config.ts

Create a config file in your project root. Set tmpDir to enable CSS splitting.

// mochi.config.ts
import { defineConfig } from "@mochi-css/config"

export default defineConfig({
    tmpDir: ".mochi",
})

See @mochi-css/config for the full list of shared options.

2. postcss.config.js

Add the PostCSS plugin:

// postcss.config.js
module.exports = {
    plugins: {
        '@mochi-css/postcss': {}
    }
}

The plugin reads tmpDir from mochi.config.ts automatically - no need to repeat it here. See @mochi-css/postcss for PostCSS-specific options.

3. next.config.ts

Wrap your Next.js config with withMochi:

// next.config.ts
import type { NextConfig } from "next"
import { withMochi } from "@mochi-css/next"

const nextConfig: NextConfig = {}

export default withMochi(nextConfig)

4. Import globals.css in your layout

Create a src/app/globals.css (or wherever your global stylesheet lives) and import it in your root layout:

// src/app/layout.tsx
import "./globals.css"

export default function RootLayout({ children }: { children: React.ReactNode }) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    )
}

Turbopack

withMochi hooks into Turbopack automatically - but only if you have already opted in via your Next.js config. Please explicitly specify in your Next.js config whether you are using turbopack to avoid configuration errors and unexpected behaviors.

Next.js 15.3+ / 16 - use the top-level turbopack key:

// next.config.ts
const nextConfig: NextConfig = {
    turbopack: {},
}

export default withMochi(nextConfig)

Next.js 14 / 15.0–15.2 - use experimental.turbo:

// next.config.ts
const nextConfig: NextConfig = {
    experimental: {
        turbo: {},
    },
}

export default withMochi(nextConfig)

Options

Most options are read automatically from mochi.config.ts. See @mochi-css/config for the full list.

The following option is specific to the Next.js integration:

| Option | Type | Default | Description | |----------------|----------|----------------------------|----------------------------------------------------------------| | manifestPath | string | .mochi/manifest.json | Path to the manifest written by PostCSS's tmpDir option |

manifestPath

Only set this if your PostCSS tmpDir is not the same as in the shared config:

export default withMochi(nextConfig, {
    manifestPath: "custom-dir/manifest.json",
})

The PostCSS tmpDir and the Next.js manifestPath must point to the same directory. By default, they both use the value from the shared config, so no extra configuration is needed.

Prefer setting options in mochi.config.ts - inline options override the file config but are not shared with other integrations.