From 4aa94f7d17a91187123bebecd4b436f687746b9e Mon Sep 17 00:00:00 2001 From: "gaoyuan.1226" Date: Wed, 27 Nov 2024 17:26:32 +0800 Subject: [PATCH] chore: use fs.promises --- website/docs/en/guide/advanced/ssr.mdx | 7 +++---- website/docs/zh/guide/advanced/ssr.mdx | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/website/docs/en/guide/advanced/ssr.mdx b/website/docs/en/guide/advanced/ssr.mdx index f7f7ab8b9e..3f5706e9cc 100644 --- a/website/docs/en/guide/advanced/ssr.mdx +++ b/website/docs/en/guide/advanced/ssr.mdx @@ -167,10 +167,9 @@ export default { ``` ```ts title=server.ts -function renderHtmlPage(): string { - const { entries } = JSON.parse( - fs.readFileSync('./dist/manifest.json', 'utf-8'), - ); +async function renderHtmlPage(): Promise { + const manifest = await fs.promises.readFile('./dist/manifest.json', 'utf-8'); + const { entries } = JSON.parse(manifest); const { js, css } = entries['index'].initial; diff --git a/website/docs/zh/guide/advanced/ssr.mdx b/website/docs/zh/guide/advanced/ssr.mdx index 90b2c91786..f59f33834a 100644 --- a/website/docs/zh/guide/advanced/ssr.mdx +++ b/website/docs/zh/guide/advanced/ssr.mdx @@ -167,11 +167,10 @@ export default { ``` ```ts title=server.ts -function renderHtmlPage(): string { - const { entries } = JSON.parse( - fs.readFileSync('./dist/manifest.json', 'utf-8'), - ); +async function renderHtmlPage(): Promise { + const manifest = await fs.promises.readFile('./dist/manifest.json', 'utf-8'); + const { entries } = JSON.parse(manifest); const { js, css } = entries['index'].initial; const scriptTags = js