Skip to content

Commit

Permalink
chore: use fs.promises
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy committed Nov 27, 2024
1 parent c00b06a commit 4aa94f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions website/docs/en/guide/advanced/ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
const manifest = await fs.promises.readFile('./dist/manifest.json', 'utf-8');
const { entries } = JSON.parse(manifest);

const { js, css } = entries['index'].initial;

Expand Down
7 changes: 3 additions & 4 deletions website/docs/zh/guide/advanced/ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
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
Expand Down

0 comments on commit 4aa94f7

Please sign in to comment.