vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
35 lines (33 loc) • 827 B
JavaScript
/**
* vite-plugin-react-server
* Copyright (c) Nico Brinkkemper
* MIT License
*/
const isServer = process.env["NODE_OPTIONS"]?.match(/--conditions[= ]react-server/);
const viteReactServer = async (options) => {
if (!isServer) {
return () => {
};
} else {
const module = await import('./server.js');
return module.vitePluginReactServer(options);
}
};
const viteReactClient = async (options) => {
if (isServer) {
return () => {
};
} else {
const module = await import('./client.js');
return module.vitePluginReactClient(options);
}
};
const viteReactStream = (options) => {
if (isServer) {
return viteReactClient(options);
} else {
return viteReactServer(options);
}
};
export { viteReactClient, viteReactServer, viteReactStream };
//# sourceMappingURL=index.js.map