#How to custom React vite plugin

14 messages · Page 1 of 1 (latest)

spice sphinx
#

Hi ! I want to test react-strict-dom with TanStack start but I don't really know how to custom the react vite plugin to use StyleX + RSD babel plugin/preset.

Thanks!

import { defineConfig } from "@tanstack/react-start/config";
import tsConfigPaths from "vite-tsconfig-paths";
import react from "@vitejs/plugin-react";

export default defineConfig({
  vite: {
    plugins: [
      react({
        babel: {
          // plugins: [
          //   [
          //     "@stylexjs/babel-plugin",
          //     {
          //       dev: process.env.NODE_ENV === "development",
          //       test: process.env.NODE_ENV === "test",
          //       runtimeInjection: false,
          //       genConditionalClasses: true,
          //       treeshakeCompensation: true,
          //       unstable_moduleResolution: { type: "commonJS" },
          //     },
          //   ],
          // ],
          // presets: [
          //   // "babel-preset-expo",
          //   [
          //     "react-strict-dom/babel-preset",
          //     {
          //       debug: process.env.NODE_ENV === "development",
          //       dev: process.env.NODE_ENV === "development",
          //       platform: process.env.PLATFORM || "web",
          //     },
          //   ],
          // ],
        },
      }),
      tsConfigPaths({
        projects: ["./tsconfig.json"],
      }),
    ],
  },
});
topaz sandal
#

what happens if you configure it like that?

spice sphinx
#

I guess that register the React plugin twice

spice sphinx
topaz sandal
#

dont really know, sorry

spice sphinx
spice sphinx
# topaz sandal dont really know, sorry

Wouldn't it be the fault of tanstack start to export defineConfig rather than using vite.config directly and exporting a plugin for tanstack?

( sorry for my english )

topaz sandal
#

we are working on becoming just a vite plugin

#

but as of now, we are not

spice sphinx
#

oh that's nice

#

is this planned on a roadmap or something ?

topaz sandal
#

we currently are based on vinxi, and we are removing that to be based on vite/nitro alone

#

ongoing effort, high prio