Skip to content

Commit efdf26c

Browse files
Ensure vite-node doesn't load PostCSS config (#13489)
1 parent a548ae3 commit efdf26c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/little-cups-deliver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
When executing `react-router.config.ts` and `routes.ts` with `vite-node`, ensure that PostCSS config files are ignored

packages/react-router-dev/vite/vite-node.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ export async function createContext({
3636
optimizeDeps: {
3737
noDiscovery: true,
3838
},
39+
css: {
40+
// This empty PostCSS config object prevents the PostCSS config file from
41+
// being loaded. We don't need it in a React Router config context, and
42+
// there's also an issue in Vite 5 when using a .ts PostCSS config file in
43+
// an ESM project: https://github.com/vitejs/vite/issues/15869. Consumers
44+
// can work around this in their own Vite config file, but they can't
45+
// configure this internal usage of vite-node.
46+
postcss: {},
47+
},
3948
configFile: false,
4049
envFile: false,
4150
plugins: [],

0 commit comments

Comments
 (0)