Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr-build): Generate document in ssr build too! #9310

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/vite/src/buildFeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from 'path'
import type { PluginBuild } from 'esbuild'
import { build as esbuildBuild } from 'esbuild'
import type { Manifest as ViteBuildManifest } from 'vite'
import { build as viteBuild } from 'vite'

import {
getRouteHookBabelPlugins,
Expand Down Expand Up @@ -65,18 +66,18 @@ export const buildFeServer = async ({ verbose, webDir }: BuildOptions = {}) => {
// Step 1A: Generate the client bundle
await buildWeb({ verbose })

// TODO (STREAMING) When Streaming is released Vite will be the only bundler,
// so we can switch to a regular import
// @NOTE: Using dynamic import, because vite is still opt-in
const { build: viteBuild } = await import('vite')

// Step 1B: Generate the server output
await viteBuild({
configFile: viteConfigPath,
build: {
// Because we configure the root to be web/src, we need to go up one level
outDir: rwPaths.web.distServer,
ssr: rwPaths.web.entryServer,
ssr: true, // use boolean, and supply the inputs in rollup options (see Documentation)
rollupOptions: {
input: {
'entry.server': rwPaths.web.entryServer,
Document: rwPaths.web.document, // We need the document for React's fallback
},
},
},
envFile: false,
logLevel: verbose ? 'info' : 'warn',
Expand Down
Loading