Registry / web-framework / vite-plugin-stylex-dev

vite-plugin-stylex-dev

JSON →
library0.8.0jsnpmunverified

An unofficial Vite plugin for integrating Stylex, a CSS-in-JS library from Meta. Version 0.8.0 is the current stable release, updated regularly on GitHub. This plugin provides HMR support, CSS automatic injection (via virtual module), and customization through babelConfig and CSS order control. It differs from other Stylex integrations by being Vite-specific and offering manual CSS ordering, making it suitable for SSR frameworks. It requires Stylex as a peer dependency and is ESM-only, targeting modern development workflows.

npm install vite-plugin-stylex-dev
INSTALL
IMPORT
SIG · VITE-PLUGIN-STYLEX
V
vite-plugin-stylex-dev
web-frameworkjavascriptv0.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stylex
import { stylex } from 'vite-plugin-stylex-dev'
import stylex from 'vite-plugin-stylex-dev'
Named export, not default. The plugin is ESM-only, no CommonJS require() available.
StylexConfig
import type { StylexConfig } from 'vite-plugin-stylex-dev'
import { StylexConfig } from 'vite-plugin-stylex-dev'
TypeScript type, import using 'import type' to avoid runtime inclusion.
virtual:stylex.css
import 'virtual:stylex.css'
Virtual module, no explicit export. Import as side effect when not using manuallyControlCssOrder.

Sets up the vite-plugin-stylex-dev plugin in Vite config and imports the virtual CSS module in the entry file for automatic style injection.

// vite.config.ts import { defineConfig } from 'vite'; import { stylex } from 'vite-plugin-stylex-dev'; export default defineConfig({ plugins: [stylex()] }); // In your entry file import 'virtual:stylex.css';
Debug
Known issues
breakingThis is an unofficial plugin not affiliated with Meta. Breaking changes may occur without notice.
fix
Pin exact version and read migration notes in the repo.
affects: >=0.0
deprecatedThe 'unstable_moduleResolution' option is experimental and may be removed or changed in future versions.
fix
Monitor the Stylex documentation for official module resolution support.
affects: >=0.0
gotchaCannot use CommonJS require() for this plugin. It is ESM-only and will throw an error if required.
fix
Use ESM import syntax: import { stylex } from 'vite-plugin-stylex-dev'.
affects: >=0.0
gotchaIf 'manuallyControlCssOrder' is false (default), you must import 'virtual:stylex.css' in your entry point, or CSS will not be injected.
fix
Add import 'virtual:stylex.css' in your entry file or set manuallyControlCssOrder: true.
affects: >=0.0
gotchaThe plugin does not work with Vite's 'css.modules' or other CSS preprocessing; it relies on its Babel transform.
fix
Disable competing CSS modules or PostCSS config if conflicts arise.
affects: >=0.0
Errors
Common errors & fixes
Cannot find module 'vite-plugin-stylex-dev' or its corresponding type declarations.
TypeScript not recognizing the plugin's types, usually due to missing @types or incorrect module resolution.
fix
Ensure the package is installed: npm install -D vite-plugin-stylex-dev. Add 'vite-plugin-stylex-dev' to 'types' in tsconfig.json if needed.
SyntaxError: The requested module 'vite-plugin-stylex-dev' does not provide an export named 'default'
Using default import instead of named import.
fix
Use import { stylex } from 'vite-plugin-stylex-dev' (curly braces).
ReferenceError: __import_star is not defined
Using the plugin with a CJS environment (e.g., Node.js with type: 'commonjs').
fix
Set 'type': 'module' in package.json or use .mjs extension for Vite config.
Upgrade
Version history
0.8.0latest on npm
Audit
Dependencies
@stylexjs/stylexrequiredPeer dependency required for runtime style generation
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
vite-plugin-stylex-dev — npm install vite-plugin-stylex-dev · libregistry