Skip to content

Commit

Permalink
fix: virtual:server-css-proxy wait for buildSteps.closeBundleServer
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jun 6, 2024
1 parent fbd6cd1 commit 6882de1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
5 changes: 1 addition & 4 deletions packages/react-server/src/features/assets/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ export function vitePluginServerAssets({
return code + `if (import.meta.hot) { import.meta.hot.accept() }`;
}
if (manager.buildType) {
// TODO: this virtual also needs to wait for server build
if (1) {
return "";
}
await manager.buildSteps.closeBundleServer;
// TODO: probe manifest to collect css?
const files = await fs.promises.readdir("./dist/rsc/assets", {
withFileTypes: true,
Expand Down
19 changes: 3 additions & 16 deletions packages/react-server/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ class PluginStateManager {
buildSteps = {
buildStartBrowser: createManualPromise<void>(),
buildStartServer: createManualPromise<void>(),
buildEndBrowser: createManualPromise<void>(),
buildEndServer: createManualPromise<void>(),
virtualClientReferenes: createManualPromise<void>(),
closeBundleServer: createManualPromise<void>(),
};

routeToClientReferences: Record<string, string[]> = {};
Expand Down Expand Up @@ -207,13 +206,10 @@ export function vitePluginReactServer(options?: {
}
},
},
buildEnd: {
closeBundle: {
order: "post",
async handler() {
if (manager.buildType === "parallel") {
manager.buildSteps.buildEndServer.resolve();
await manager.buildSteps.buildEndBrowser;
}
manager.buildSteps.closeBundleServer.resolve();
},
},
},
Expand Down Expand Up @@ -380,15 +376,6 @@ export function vitePluginReactServer(options?: {
}
},
},
buildEnd: {
order: "post",
async handler() {
if (manager.buildType === "parallel") {
manager.buildSteps.buildEndBrowser.resolve();
await manager.buildSteps.buildEndServer;
}
},
},
},
vitePluginSilenceDirectiveBuildWarning(),
vitePluginClientUseServer({
Expand Down

0 comments on commit 6882de1

Please sign in to comment.