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

unplugin-stylex

v0.6.3

Published

Unplugin for stylex

Readme

unplugin-stylex · GitHub license npm version

unplugin-stylex brings StyleX transform support to multiple bundlers via unplugin.

Installation

npm i -D unplugin-stylex @stylexjs/stylex

or

yarn add -D unplugin-stylex @stylexjs/stylex

or

pnpm add -D unplugin-stylex @stylexjs/stylex

Requirements

Supported Targets

  • Vite (unplugin-stylex/vite)
  • Astro integration (unplugin-stylex/astro)
  • Esbuild (unplugin-stylex/esbuild)
  • Farm (unplugin-stylex/farm)
  • Rspack (unplugin-stylex/rspack)
  • RSBuild (through Rspack plugin in tools.rspack.plugins)
  • Rolldown (unplugin-stylex/rolldown)
  • Rollup (unplugin-stylex/rollup)
  • Webpack (unplugin-stylex/webpack)

Quick Start

// vite.config.js
import { defineConfig } from 'vite'
import stylexPlugin from 'unplugin-stylex/vite'

export default defineConfig({
  plugins: [
    stylexPlugin(),
  ],
})
// astro.config.mjs
import { defineConfig } from 'astro/config'
import stylexAstroPlugin from 'unplugin-stylex/astro'

export default defineConfig({
  integrations: [
    stylexAstroPlugin(),
  ],
})
// esbuild.config.js
import { build } from 'esbuild'
import stylexPlugin from 'unplugin-stylex/esbuild'

build({
  entryPoints: ['src/index.tsx'],
  bundle: true,
  outfile: 'dist/out.js',
  plugins: [stylexPlugin()],
})
// farm.config.js
import { defineConfig } from '@farmfe/core'
import stylexPlugin from 'unplugin-stylex/farm'

export default defineConfig({
  plugins: [stylexPlugin()],
})
// rspack.config.js
import stylexPlugin from 'unplugin-stylex/rspack'

export default {
  plugins: [stylexPlugin()],
}
// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core'
import stylexPlugin from 'unplugin-stylex/rspack'

export default defineConfig({
  tools: {
    rspack: {
      plugins: [stylexPlugin()],
    },
  },
})
// rolldown.config.mjs
import { defineConfig } from 'rolldown'
import stylexPlugin from 'unplugin-stylex/rolldown'

export default defineConfig({
  plugins: [stylexPlugin()],
})
// rollup.config.js
import stylexPlugin from 'unplugin-stylex/rollup'

export default {
  plugins: [stylexPlugin()],
}
// webpack.config.js
const stylexPlugin = require('unplugin-stylex/webpack').default

module.exports = {
  plugins: [stylexPlugin()],
}

Options

type UnpluginStylexOptions = {
  validExts?: RegExp | string[]
  dev?: boolean
  stylex?: {
    filename?: string
    aliases?: Record<string, string | string[]>
    stylexImports?: string[]
    classNamePrefix?: string
    unstable_moduleResolution?: {
      type: 'commonJS' | 'haste'
      rootDir: string
    }
    babelConfig?: {
      plugins: unknown[]
      presets: unknown[]
      babelrc: boolean
    }
    useCSSLayers?: boolean
    genConditionalClasses?: boolean
    treeshakeCompensation?: boolean
    runtimeInjection?: boolean
  }
}

Defaults

  • validExts: /\.[mc]?[jt]sx?$|\.svelte$|\.vue$/
  • dev: inferred from environment (NODE_ENV / BABEL_ENV) unless explicitly set
  • stylex.filename: 'stylex.css'
  • stylex.stylexImports: ['@stylexjs/stylex']
  • stylex.runtimeInjection: follows dev by default
  • stylex.aliases: auto-reads from project config (TS paths + bundler aliases when available)
  • stylex.useCSSLayers: false
  • stylex.unstable_moduleResolution: { type: 'commonJS', rootDir: process.cwd() }
  • stylex.babelConfig: { babelrc: false, plugins: [], presets: [] }

Notes

  • The plugin only transforms modules containing at least one stylexImports source.
  • Output CSS is emitted as an asset file (stylex.css by default).
  • Vite and Astro integrations also handle dev server CSS serving and HTML injection.
  • Astro integration defaults validExts to include .astro and .stylex.
  • For Farm projects, treeshakeCompensation: true is usually needed (see example config).

Examples

Acknowledgments