Skip to content

Commit b1d63a8

Browse files
authored
test(rsc): fix ssr modulepreload link test (#565)
1 parent b598bb5 commit b1d63a8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/plugin-rsc/e2e/react-router.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { createHash } from 'node:crypto'
2-
import path from 'node:path'
32
import { expect, test } from '@playwright/test'
43
import { type Fixture, useFixture } from './fixture'
54
import { expectNoReload, testNoJs, waitForHydration } from './helper'
5+
import { readFileSync } from 'node:fs'
66

77
test.describe('dev-default', () => {
88
const f = useFixture({ root: 'examples/react-router', mode: 'dev' })
@@ -74,8 +74,11 @@ function defineTest(f: Fixture) {
7474
.evaluateAll((elements) =>
7575
elements.map((el) => el.getAttribute('href')),
7676
)
77-
const { default: manifest } = await import(
78-
path.resolve(f.root, 'dist/ssr/__vite_rsc_assets_manifest.js')
77+
const manifest = JSON.parse(
78+
readFileSync(
79+
f.root + '/dist/ssr/__vite_rsc_assets_manifest.js',
80+
'utf-8',
81+
).slice('export default '.length),
7982
)
8083
const hashString = (v: string) =>
8184
createHash('sha256').update(v).digest().toString('hex').slice(0, 12)

0 commit comments

Comments
 (0)