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
3 changes: 2 additions & 1 deletion packages/plugin-rsc/e2e/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ export async function setupInlineFixture(options: {

// write additional files
if (options.files) {
for (const [filename, contents] of Object.entries(options.files)) {
for (let [filename, contents] of Object.entries(options.files)) {
let filepath = path.join(options.dest, filename)
fs.mkdirSync(path.dirname(filepath), { recursive: true })
// strip indent
contents = contents.replace(/^\n/, '')
const indent = contents.match(/^\s*/)?.[0] ?? ''
const strippedContents = contents
.split('\n')
Expand Down
60 changes: 60 additions & 0 deletions packages/plugin-rsc/e2e/starter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,66 @@ test.describe(() => {
})
})

test.describe(() => {
const root = 'examples/e2e/temp/module-runner-hmr-false'

test.beforeAll(async () => {
await setupInlineFixture({
src: 'examples/starter',
dest: root,
files: {
'vite.config.ts': /* js */ `
import rsc from '@vitejs/plugin-rsc'
import react from '@vitejs/plugin-react'
import { defineConfig, createRunnableDevEnvironment } from 'vite'

export default defineConfig({
plugins: [
react(),
rsc({
entries: {
client: './src/framework/entry.browser.tsx',
ssr: './src/framework/entry.ssr.tsx',
rsc: './src/framework/entry.rsc.tsx',
}
}),
],
environments: {
ssr: {
dev: {
createEnvironment(name, config) {
return createRunnableDevEnvironment(name, config, {
runnerOptions: {
hmr: false,
},
})
},
},
},
rsc: {
dev: {
createEnvironment(name, config) {
return createRunnableDevEnvironment(name, config, {
runnerOptions: {
hmr: false,
},
})
},
},
},
},
})
`,
},
})
})

test.describe('dev-module-runner-hmr-false', () => {
const f = useFixture({ root, mode: 'dev' })
defineTest(f)
})
})

function defineTest(f: Fixture, variant?: 'no-ssr') {
const waitForHydration: typeof waitForHydration_ = (page) =>
waitForHydration_(page, variant === 'no-ssr' ? '#root' : 'body')
Expand Down
Loading