{"id":22859,"library":"vite-plugin-stylex","title":"vite-plugin-stylex","description":"Integrates StyleX CSS-in-JS library with Vite build tool. Current version 0.13.0 supports StyleX 0.9.3, Vite ^5.2.7. Active development with monthly releases. Differentiates by leveraging Vite's CSS pipeline for minification and post-processing, supporting LightningCSS, CSS layers, and automatic style generation. Requires manual Vite configuration unlike some auto-setup CSS-in-JS solutions.","status":"active","version":"0.13.0","language":"javascript","source_language":"en","source_url":"https://github.com/HorusGoul/vite-plugin-stylex","tags":["javascript","vite","stylex","css-in-js","plugin"],"install":[{"cmd":"npm install vite-plugin-stylex","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-stylex","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-stylex","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core peer dependency for StyleX functionality","package":"@stylexjs/stylex","optional":false},{"reason":"Peer dependency; requires Vite ^5.2.7","package":"vite","optional":false}],"imports":[{"note":"Default export; named import will cause undefined.","wrong":"import { vitePluginStylex } from 'vite-plugin-stylex'","symbol":"vitePluginStylex","correct":"import vitePluginStylex from 'vite-plugin-stylex'"},{"note":"TypeScript users should import Vite's UserConfig separately; this plugin does not re-export it.","wrong":null,"symbol":"UserConfig export","correct":"import type { UserConfig } from 'vite'"},{"note":"ESM-only package; require() returns module with default export, so .default is needed.","wrong":"const vitePluginStylex = require('vite-plugin-stylex')","symbol":"CommonJS require","correct":"const vitePluginStylex = require('vite-plugin-stylex').default"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport vitePluginStylex from 'vite-plugin-stylex';\n\nexport default defineConfig({\n  plugins: [\n    vitePluginStylex({\n      useCSSLayers: true,\n      stylexImports: ['@stylexjs/stylex'],\n      unstable_moduleResolution: {\n        type: 'commonJS',\n        rootDir: import.meta.url,\n      },\n    }),\n  ],\n});","lang":"typescript","description":"Minimal Vite config with vite-plugin-stylex showing common options: CSS layers, StyleX imports, and module resolution for CommonJS compatibility."},"warnings":[{"fix":"Upgrade to Vite ^5.2.7 and plugin >=0.9.0.","message":"BREAKING CHANGE: Plugin now requires Vite 5.2.7 or higher","severity":"breaking","affected_versions":"<0.9.0"},{"fix":"Ensure Vite's CSS handling is not disabled; CSS minification and post-processing are now Vite-controlled.","message":"BREAKING CHANGE: Plugin now delegates CSS processing to Vite, requiring Vite's CSS pipeline","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Use @/_ or @src/_ instead of @\\_ or @src\\_ in path aliases.","message":"Alias path on Windows uses forward slashes","severity":"gotcha","affected_versions":">=0.8.3"},{"fix":"May cause delay in style generation; update Vite if API changes.","message":"Plugin uses Vite's waitForRequestsIdle experimental API for development","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Monitor release notes for stable API replacements.","message":"Options like 'stylexImports' and 'unstable_moduleResolution' may change in future versions","severity":"deprecated","affected_versions":">=0.9.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install @stylexjs/stylex","cause":"Missing peer dependency @stylexjs/stylex","error":"Error: Cannot find module '@stylexjs/stylex'"},{"fix":"Use `import vitePluginStylex from 'vite-plugin-stylex'` (no braces)","cause":"Importing as named export instead of default","error":"TypeError: vitePluginStylex is not a function"},{"fix":"Ensure plugin is included in the `plugins` array: `plugins: [vitePluginStylex()]`","cause":"Plugin used outside Vite's plugin array or misconfigured","error":"[plugin:vite-plugin-stylex] Stylex plugin is not a function"},{"fix":"Upgrade to Vite ^5.2.7","cause":"Using an older version of Vite","error":"Error: Vite 5.2.7 or higher is required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}