Skip to content

Commit

Permalink
fix: workaround custom environment condition
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 4, 2024
1 parent 13330d9 commit f6f9625
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/fetch/src/entry-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { ViteDevServer } from "vite";
import type { StreamData } from "./entry-rsc";

export default async function handler(request: Request): Promise<Response> {
console.log(request.url);
const url = new URL(request.url);
const response = await handleRsc(request);
if (url.searchParams.has("__f")) {
Expand Down
6 changes: 4 additions & 2 deletions examples/fetch/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default defineConfig((_env) => ({
return () => {
server.middlewares.use(
webToNodeHandler(async (request) => {
if (1) {
if (0) {
// debug
return (server.environments["rsc"] as any).dispatchFetch(
"/src/entry-rsc.tsx",
request,
Expand All @@ -36,8 +37,9 @@ export default defineConfig((_env) => ({
],
environments: {
rsc: {
// TODO: avoid mixed condition for ssr/rsc envs https://github.com/vitejs/vite/issues/18222
webCompatible: true,
resolve: {
conditions: ["react-server"],
externalConditions: ["react-server"],
},
dev: {
Expand Down

0 comments on commit f6f9625

Please sign in to comment.