Skip to content

Commit

Permalink
Make vite-plugin-stylex run in production mode only when the command …
Browse files Browse the repository at this point in the history
…is "build" (#45)
  • Loading branch information
HorusGoul authored Feb 23, 2024
1 parent 0dc6fb9 commit 5c3523a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/neat-trees-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vite-plugin-stylex": patch
---

Make vite-plugin-stylex run in production mode only when the command is "build". Fixes #42.
4 changes: 2 additions & 2 deletions packages/vite-plugin-stylex/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ export default function styleXVitePlugin({
return {
name: "vite-plugin-stylex",

config(config, env) {
isProd = env.mode === "production" || config.mode === "production";
config(config) {
assetsDir = config.build?.assetsDir || "assets";
publicBasePath = config.base || "/";
},

configResolved(config) {
config.optimizeDeps.exclude = config.optimizeDeps.exclude || [];
config.optimizeDeps.exclude.push("@stylexjs/open-props");
isProd = config.command === "build";

for (const viteAlias of config.resolve.alias) {
if (typeof viteAlias.find === "string") {
Expand Down

0 comments on commit 5c3523a

Please sign in to comment.