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

turbopack-unocss-transform

v1.1.1

Published

A Turbopack loader for Next.js that applies UnoCSS transformers (like variant-group and attributify-jsx) directly to your TS/JS/TSX/JSX source before CSS generation.

Readme

turbopack-unocss-transform

Turbopack loader for Next.js that applies UnoCSS transformers (transformerAttributifyJsx, transformerVariantGroup, transformerDirectives) to source files.

@unocss/postcss handles CSS generation; this loader transforms JS/TS/JSX/TSX source code.

Requirements

| Dependency | Version | | ---------- | ------------------------------------------------------------------ | | Node.js | ≥23.6.0 (native TypeScript support if you use uno.config.ts) | | Next.js | ≥15.0.0 | | UnoCSS | ≥66.0.0 |

Installation

pnpm add -D turbopack-unocss-transform @unocss/postcss

Setup

1. next.config.ts

import type {NextConfig} from "next"
import withUnoTransform from "turbopack-unocss-transform"

const nextConfig: NextConfig = withUnoTransform({
  // your config
})

export default nextConfig

2. postcss.config.mjs

[!IMPORTANT] Import the config object, not a path string. Passing a string or without the configOrPath setting disables HMR - Turbopack won't detect config changes.

import config from "./uno.config.ts"

export default {
  plugins: [
    ["@unocss/postcss", {configOrPath: config}]
  ]
}

3. tsconfig.json

[!IMPORTANT] Required. Node.js 23+ executes TypeScript natively but requires explicit .ts extensions in imports. This flag allows TypeScript to accept them.

{
  "compilerOptions": {
    "allowImportingTsExtensions": true,
    "noEmit": true
  }
}

4. uno.config.ts

[!WARNING] All local imports must include .ts extension. PostCSS runs via Node.js worker (not Turbopack), which requires explicit extensions for TypeScript files.

import type {UserConfig} from "@unocss/core"
import {presetAttributify} from "@unocss/preset-attributify"
import {presetWind4} from "@unocss/preset-wind4"
import transformerAttributifyJsx from "@unocss/transformer-attributify-jsx"
import transformerDirectives from "@unocss/transformer-directives"
import transformerVariantGroup from "@unocss/transformer-variant-group"
import theme from "./src/styles/theme/index.ts"
import preflights from "./src/styles/theme/preflights.ts"

export default {
  presets: [presetWind4(), presetAttributify()],
  transformers: [
    transformerAttributifyJsx(),
    transformerDirectives(),
    transformerVariantGroup()
  ],
  theme,
  preflights
} satisfies UserConfig

[!CAUTION] Avoid importing from the unocss meta-package. It re-exports all presets including @unocss/preset-icons, which depends on mlly that uses dynamic import(dataURL) - not supported by Turbopack.

This will fail:

import {defineConfig, presetWind4} from "unocss" // ❌ Pulls in mlly

Use separate packages instead:

import {presetWind4} from "@unocss/preset-wind4" // ✅

You can try the meta-package - it might work in future versions, but this setup was tested with separate packages only.

5. Global styles (e.g., global.sass)

@unocss all

html, body
  @apply text-dark font-sans

Why explicit .ts extensions?

PostCSS config is executed by a Node.js worker, not Turbopack. Node.js 23+ runs TypeScript natively but doesn't resolve .ts extensions automatically — they must be explicit.

Without explicit extensions:

Module not found: Can't resolve './src/styles/theme'

HMR behavior

| postcss.config.mjs | HMR | | -------------------------------------- | -------- | | import config from "./uno.config.ts" | ✅ Works | | {configOrPath: "./uno.config.ts"} | ❌ No HMR |

When using path string, Turbopack doesn't track uno.config.ts as a dependency — changes require next dev restart.

Tested with

  • Next.js 16.1.3
  • UnoCSS 66.5.6
  • Node.js 23.11.0