Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/node/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export async function build(
) as OutputChunk)

const cssChunk = (
siteConfig.mpa ? serverResult : clientResult
siteConfig.mpa ? serverResult : clientResult!
).output.find(
(chunk) => chunk.type === 'asset' && chunk.fileName.endsWith('.css')
) as OutputAsset

const assets = (siteConfig.mpa ? serverResult : clientResult).output
const assets = (siteConfig.mpa ? serverResult : clientResult!).output
.filter(
(chunk) => chunk.type === 'asset' && !chunk.fileName.endsWith('.css')
)
Expand Down
12 changes: 6 additions & 6 deletions src/node/build/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function bundle(
config: SiteConfig,
options: BuildOptions
): Promise<{
clientResult: RollupOutput
clientResult: RollupOutput | null
serverResult: RollupOutput
pageToHashMap: Record<string, string>
}> {
Expand Down Expand Up @@ -142,16 +142,16 @@ export async function bundle(
}
})

let clientResult: RollupOutput
let clientResult: RollupOutput | null
let serverResult: RollupOutput

const spinner = ora()
spinner.start('building client + server bundles...')
try {
;[clientResult, serverResult] = await (Promise.all([
config.mpa ? null : build(await resolveViteConfig(false)),
build(await resolveViteConfig(true))
]) as Promise<[RollupOutput, RollupOutput]>)
clientResult = config.mpa
? null
: ((await build(await resolveViteConfig(false))) as RollupOutput)
serverResult = (await build(await resolveViteConfig(true))) as RollupOutput
} catch (e) {
spinner.stopAndPersist({
symbol: failMark
Expand Down
4 changes: 2 additions & 2 deletions src/node/build/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export async function renderPage(
config: SiteConfig,
page: string, // foo.md
result: RollupOutput | null,
appChunk: OutputChunk | undefined,
cssChunk: OutputAsset | undefined,
appChunk: OutputChunk | null,
cssChunk: OutputAsset | null,
assets: string[],
pageToHashMap: Record<string, string>,
hashMapString: string,
Expand Down