diff --git a/src/node/build/render.ts b/src/node/build/render.ts
index 26973f3e..d91a8675 100644
--- a/src/node/build/render.ts
+++ b/src/node/build/render.ts
@@ -1,8 +1,7 @@
import { isBooleanAttr } from '@vue/shared'
-import fs from 'node:fs'
-import { mkdir, writeFile } from 'node:fs/promises'
+import { mkdir, realpath, rm, writeFile } from 'node:fs/promises'
import path from 'node:path'
-import { minifySync, normalizePath, type Rolldown } from 'vite'
+import { minify, normalizePath, type Rolldown } from 'vite'
import { version } from '../../../package.json'
import type { SiteConfig } from '../config'
import {
@@ -86,7 +85,7 @@ export async function renderPage(
// resolve imports for index.js + page.md.js and inject script tags
// for them as well so we fetch everything as early as possible
// without having to wait for entry chunks to parse
- ...resolvePageImports(config, page, result, appChunk),
+ ...(await resolvePageImports(config, page, result, appChunk)),
pageClientJsFileName
])
]
@@ -148,7 +147,7 @@ export async function renderPage(
if (matchingChunk) {
if (!matchingChunk.code.includes('import')) {
inlinedScript = ``
- fs.rmSync(path.resolve(config.outDir, matchingChunk.fileName), {
+ await rm(path.resolve(config.outDir, matchingChunk.fileName), {
force: true
})
} else {
@@ -208,7 +207,7 @@ export async function renderPage(
await writeFile(htmlFileName, transformedHtml || html)
}
-function resolvePageImports(
+async function resolvePageImports(
config: SiteConfig,
page: string,
result: Rolldown.RolldownOutput,
@@ -220,7 +219,7 @@ function resolvePageImports(
let srcPath = path.resolve(config.srcDir, page)
try {
if (!config.vite?.resolve?.preserveSymlinks) {
- srcPath = fs.realpathSync(srcPath)
+ srcPath = await realpath(srcPath)
}
} catch (e) {
// if the page is a virtual page generated by a dynamic route this would
@@ -248,7 +247,7 @@ async function renderHead(head: HeadConfig[]): Promise {
tag === 'script' &&
(attrs.type === undefined || attrs.type.includes('javascript'))
) {
- innerHTML = minifySync('inline-script.js', innerHTML).code
+ innerHTML = (await minify('inline-script.js', innerHTML)).code
}
return `${openTag}${innerHTML}${tag}>`
} else {