Skip to content

Commit a7ab88a

Browse files
fix(dev): handle critical CSS with absolute base and Vite Env API (#13598)
Co-authored-by: Mark Dalgleish <[email protected]>
1 parent 5c8ccd0 commit a7ab88a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.changeset/cyan-cougars-trade.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 `future.unstable_viteEnvironmentApi` is enabled and an absolute Vite `base` has been configured, ensure critical CSS is handled correctly during development

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
- chaance
6767
- chasinhues
6868
- chensokheng
69+
- chr33s
6970
- chrisngobanh
7071
- christopherchudzicki
7172
- ChristophP

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
15761576
if (ctx.reactRouterConfig.future.unstable_viteEnvironmentApi) {
15771577
viteDevServer.middlewares.use(async (req, res, next) => {
15781578
let [reqPathname, reqSearch] = (req.url ?? "").split("?");
1579-
if (reqPathname === `${ctx.publicPath}@react-router/critical.css`) {
1579+
if (reqPathname.endsWith("/@react-router/critical.css")) {
15801580
let pathname = new URLSearchParams(reqSearch).get("pathname");
15811581
if (!pathname) {
15821582
return next("No pathname provided");

0 commit comments

Comments
 (0)