Skip to content

Commit

Permalink
refactor: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jun 5, 2024
1 parent eb4d1d1 commit e576da7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/react-server/src/features/server-action/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export function vitePluginServerUseServer({
id,
outCode: output.toString(),
});
if (manager.buildType === "rsc") {
this.emitFile({
type: "chunk",
id,
});
}
return {
code: output.toString(),
map: output.generateMap(),
Expand Down Expand Up @@ -154,7 +160,10 @@ export function vitePluginServerUseServer({
// https://github.com/ArnaudBarre/downwind/blob/1d47b6a3f1e7bc271d0bb5bd96cfbbea68445510/src/vitePlugin.ts#L164
function waitForIdlePlugin(): Plugin[] {
const idlePromise = createManualPromise<void>();
const notIdle = debounce(() => {
let done = false;
const notIdle = debounce((...args) => {
console.log("[wait-for-idle:done]", { args });
done = true;
idlePromise.resolve();
}, 200);

Expand All @@ -169,9 +178,9 @@ function waitForIdlePlugin(): Plugin[] {
id: "virtual:wait-for-idle",
});
},
resolveId: () => notIdle(),
load: () => notIdle(),
transform: () => notIdle(),
resolveId: notIdle,
load: notIdle,
transform: notIdle,
},
createVirtualPlugin("wait-for-idle", async () => {
await idlePromise;
Expand Down

0 comments on commit e576da7

Please sign in to comment.