@redwoodjs/sdk
Version:
A full-stack webapp toolkit designed for TypeScript, Vite, and React Server Components
24 lines (23 loc) • 675 B
JavaScript
export const asyncSetupPlugin = ({ setup, }) => {
let taskPromise = Promise.resolve(null);
return [
{
name: "rw-sdk-async-setup:serve",
apply: "serve",
configureServer(server) {
taskPromise = setup({ command: "serve" });
server.middlewares.use(async (_req, _res, next) => {
await taskPromise;
next();
});
},
},
{
name: "rw-sdk-async-setup:build",
apply: "build",
async buildStart() {
await setup({ command: "build" });
},
},
];
};