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

@sanity/vanilla-extract-vite-plugin

v0.2.9

Published

Vite 8 plugin for vanilla-extract with plugin hook filters and a caching compiler on Vite's ModuleRunner

Downloads

19,002

Readme

@sanity/vanilla-extract-vite-plugin

A Vite 8 plugin for vanilla-extract applications: it compiles .css.ts modules and feeds their CSS into Vite's own CSS pipeline (PostCSS, code-splitting, HMR, SSR) as virtual .vanilla.css modules — a rolldown-era alternative to @vanilla-extract/vite-plugin:

  • Plugin hook filters on transform/resolveId/load (vanilla-extract#1641), so rolldown-based Vite 8 skips the Rust ↔ JS roundtrip for every module that isn't vanilla-extract related — the main source of the PLUGIN_TIMINGS build warnings with the upstream plugin.
  • A caching compiler on Vite's Environment API / ModuleRunner instead of the legacy vite-node: .css.ts modules are evaluated through an internal Vite server and cached in its module graph, so rebuilds and HMR only re-evaluate what changed.
  • The environment-aware hotUpdate hook instead of the deprecated handleHotUpdate.

Head-to-head numbers against @vanilla-extract/vite-pluginvite build across minify/target variants, dev HMR, and a hook-filter stress sweep — live in the vanilla-extract benchmarks.

For libraries that ship a single pre-extracted CSS file, use @sanity/vanilla-extract-rolldown-plugin (raw rolldown) or @sanity/vanilla-extract-tsdown-plugin (tsdown) instead — this plugin is for application dev servers and app builds.

Usage

pnpm add --save-dev @sanity/vanilla-extract-vite-plugin @vanilla-extract/css
// vite.config.ts
import {vanillaExtractPlugin} from '@sanity/vanilla-extract-vite-plugin'
import {defineConfig} from 'vite'

export default defineConfig({
  plugins: [vanillaExtractPlugin()],
})

Requires Vite 8. For older Vite versions, use @vanilla-extract/vite-plugin.

Options

vanillaExtractPlugin({
  /**
   * Formatting of identifiers (class names, keyframes, CSS vars, etc).
   * @defaultValue 'short' when `mode` is 'production', 'debug' otherwise
   */
  identifiers: 'short',
  /**
   * Which of your Vite plugins are re-instantiated inside the compiler server that evaluates
   * the `.css.ts` modules. By default no plugins are forwarded (and the filtering work is
   * skipped entirely) - most plugins don't affect `.css.ts` evaluation, and forwarding them
   * would run every transform twice. Vite's own options (like `resolve.tsconfigPaths`) still
   * apply to the compiler server through the forwarded config.
   */
  pluginFilter: ({name, mode}) => name === 'my-css-ts-affecting-plugin',
  /**
   * How the extracted CSS reaches the page during development. 'emitCss' (the default) serves
   * it through Vite's CSS pipeline; 'inlineCssInDev' additionally inlines all extracted CSS
   * into a <style> tag in the served HTML, preventing a flash of unstyled content in dev SSR
   * setups. Builds behave the same in both modes.
   * @defaultValue 'emitCss'
   */
  mode: 'emitCss',
})

tsconfig paths

Unlike @vanilla-extract/vite-plugin, this plugin does not forward the vite-tsconfig-paths plugin into its compiler server by default. On Vite 8, tsconfig path resolution is a built-in feature — prefer enabling resolve.tsconfigPaths in your vite.config.ts, which applies to the compiler server automatically (Vite options are forwarded as-is, only plugins are filtered):

// vite.config.ts
export default defineConfig({
  resolve: {tsconfigPaths: true},
  plugins: [vanillaExtractPlugin()],
})

If you need the vite-tsconfig-paths plugin regardless (e.g. for options the built-in doesn't cover), forward it explicitly with a pluginFilter:

vanillaExtractPlugin({
  pluginFilter: ({name}) => name === 'vite-tsconfig-paths',
})

Acknowledgements

The plugin is a port of @vanilla-extract/vite-plugin and its compiler is a port of @vanilla-extract/compiler onto Vite's Environment API (both MIT licensed, Copyright (c) 2021 SEEK). The full combined license notices are in this package's LICENSE file.