11import tailwindcss from "@tailwindcss/vite" ;
2- import react from "@vitejs/plugin-react" ;
2+ import react , { reactCompilerPreset } from "@vitejs/plugin-react" ;
3+ import babel from "@rolldown/plugin-babel" ;
34import { tanstackRouter } from "@tanstack/router-plugin/vite" ;
45import { defineConfig } from "vite" ;
5- import { version } from "./package.json" with { type : "json" } ;
6+ import pkg from "./package.json" with { type : "json" } ;
67
78const port = Number ( process . env . PORT ?? 5733 ) ;
89const sourcemapEnv = process . env . T3CODE_WEB_SOURCEMAP ?. trim ( ) . toLowerCase ( ) ;
@@ -17,10 +18,14 @@ const buildSourcemap =
1718export default defineConfig ( {
1819 plugins : [
1920 tanstackRouter ( ) ,
20- react ( {
21- babel : {
22- plugins : [ [ "babel-plugin-react-compiler" , { target : "19" } ] ] ,
23- } ,
21+ react ( ) ,
22+ babel ( {
23+ // We need to be explicit about the parser options after moving to @vitejs /plugin-react v6.0.0
24+ // This is because the babel plugin only automatically parses typescript and jsx based on relative paths (e.g. "**/*.ts")
25+ // whereas the previous version of the plugin parsed all files with a .ts extension.
26+ // This is causing our packages/ directory to fail to parse, as they are not relative to the CWD.
27+ parserOpts : { plugins : [ "typescript" , "jsx" ] } ,
28+ presets : [ reactCompilerPreset ( ) ] ,
2429 } ) ,
2530 tailwindcss ( ) ,
2631 ] ,
@@ -30,7 +35,7 @@ export default defineConfig({
3035 define : {
3136 // In dev mode, tell the web app where the WebSocket server lives
3237 "import.meta.env.VITE_WS_URL" : JSON . stringify ( process . env . VITE_WS_URL ?? "" ) ,
33- "import.meta.env.APP_VERSION" : JSON . stringify ( version ) ,
38+ "import.meta.env.APP_VERSION" : JSON . stringify ( pkg . version ) ,
3439 } ,
3540 resolve : {
3641 tsconfigPaths : true ,
0 commit comments