diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index c30d4ada7a7e1b..6f849196d6cfe1 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -419,6 +419,9 @@ export function resolveBuildEnvironmentOptions( ...buildEnvironmentOptionsDefaults, cssCodeSplit: !raw.lib, minify: consumer === 'server' ? false : 'esbuild', + rollupOptions: { + platform: consumer === 'server' ? 'node' : 'browser', + }, ssr: consumer === 'server', emitAssets: consumer === 'client', createEnvironment: (name, config) => new BuildEnvironment(name, config), diff --git a/playground/environment-react-ssr/vite.config.ts b/playground/environment-react-ssr/vite.config.ts index 78dc9aaddff106..7518f47bf06dc7 100644 --- a/playground/environment-react-ssr/vite.config.ts +++ b/playground/environment-react-ssr/vite.config.ts @@ -47,11 +47,6 @@ export default defineConfig((env) => ({ input: { index: '/src/entry-server', }, - output: { - // NOTE: needed for now: https://github.com/rolldown/rolldown/issues/2685 - banner: - "import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);", - }, }, }, },