Skip to content

Commit

Permalink
refactor(react-server): organize (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Apr 16, 2024
1 parent 47870bc commit e39c3fc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/react-server/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ export default defineConfig((_env) => ({
appType: "custom",
plugins: [
react(),
vitePluginReactServer(),
vitePluginSsrMiddleware({
entry: process.env["SERVER_ENTRY"] ?? "/src/adapters/node",
preview: new URL("./dist/server/index.js", import.meta.url).toString(),
}),
vitePluginReactServer(),
vitePluginSilenceDirectiveBuildWarning(),
vitePluginServerAction(),
],

environments: {
Expand Down Expand Up @@ -69,7 +67,7 @@ const manager: ReactServerManager = ((
).__VITE_REACT_SERVER_MANAGER ??= new ReactServerManager());

function vitePluginReactServer(): PluginOption {
const plugin: Plugin = {
const environmentPlugin: Plugin = {
name: vitePluginReactServer.name,
config(config, _env) {
tinyassert(config.environments);
Expand Down Expand Up @@ -137,7 +135,12 @@ function vitePluginReactServer(): PluginOption {
},
};

return [plugin, vitePluginUseClient()];
return [
environmentPlugin,
vitePluginUseClient(),
vitePluginSilenceDirectiveBuildWarning(),
vitePluginServerAction(),
];
}

function vitePluginUseClient(): PluginOption {
Expand Down

0 comments on commit e39c3fc

Please sign in to comment.