From 4261fdf5d367df9e39ce99967718248dbd3960b4 Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Tue, 21 Jul 2026 21:10:07 +0000 Subject: [PATCH 1/3] fix: preserve in-memory dev output --- .changeset/quiet-disks-rest.md | 5 +++++ src/index.ts | 1 - tests/features.test.ts | 2 +- tests/index.test.ts | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .changeset/quiet-disks-rest.md diff --git a/.changeset/quiet-disks-rest.md b/.changeset/quiet-disks-rest.md new file mode 100644 index 00000000..3f881289 --- /dev/null +++ b/.changeset/quiet-disks-rest.md @@ -0,0 +1,5 @@ +--- +'rsbuild-plugin-react-router': patch +--- + +Stop forcing development output to disk so `dev.writeToDisk: false` and Rsbuild's in-memory default are preserved. diff --git a/src/index.ts b/src/index.ts index 7144c910..f7abb10b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -800,7 +800,6 @@ export const pluginReactRouter = ( assetPrefix: config.output?.assetPrefix || '/', }, dev: { - writeToDisk: true, ...lazyCompilation, watchFiles: mergeWatchFiles(config.dev?.watchFiles, routeWatchFiles), }, diff --git a/tests/features.test.ts b/tests/features.test.ts index 6e1489f2..28b505cf 100644 --- a/tests/features.test.ts +++ b/tests/features.test.ts @@ -33,7 +33,7 @@ describe('pluginReactRouter', () => { // The plugin should not override Rsbuild's HMR defaults. expect(config.dev.hmr).toBe(true); expect(config.dev.liveReload).toBe(true); - expect(config.dev.writeToDisk).toBe(true); + expect(config.dev.writeToDisk).toBe(false); }); it('should register the dev server middleware via server.setup', async () => { diff --git a/tests/index.test.ts b/tests/index.test.ts index 617e1683..a58e9a63 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -60,7 +60,7 @@ describe('pluginReactRouter', () => { // The plugin should not override Rsbuild's HMR defaults. expect(config.dev.hmr).toBe(true); expect(config.dev.liveReload).toBe(true); - expect(config.dev.writeToDisk).toBe(true); + expect(config.dev.writeToDisk).toBe(false); expect(config.dev.lazyCompilation).toMatchObject({ entries: true, imports: true, From 940cf7fea07f534f00b364b7d83718a79043ec3a Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Tue, 21 Jul 2026 21:15:22 +0000 Subject: [PATCH 2/3] test: allow in-memory route additions --- examples/default-template/tests/e2e/dev-route-watch.test.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/default-template/tests/e2e/dev-route-watch.test.ts b/examples/default-template/tests/e2e/dev-route-watch.test.ts index 56dceef2..cc0e3ed2 100644 --- a/examples/default-template/tests/e2e/dev-route-watch.test.ts +++ b/examples/default-template/tests/e2e/dev-route-watch.test.ts @@ -144,7 +144,6 @@ test.describe('dev route watch', () => { }) => { await page.goto('/'); await expect(page.locator('h1')).toContainText('Welcome to React Router'); - const restartMarkerBeforeAdd = readRestartMarkerVersion(); writeFileSync( addedRoutePath, @@ -161,9 +160,6 @@ test.describe('dev route watch', () => { await page.goto(addedRouteUrl); await expect(page.locator('h1')).toHaveText(addedRouteText); - await expect - .poll(readRestartMarkerVersion, { timeout: 10000 }) - .not.toBe(restartMarkerBeforeAdd); const restartMarkerBefore = readRestartMarkerVersion(); writeFileSync( addedRoutePath, From 4ae805349bbf097cb42eeacc9bf23cea2edc903a Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Tue, 21 Jul 2026 21:22:58 +0000 Subject: [PATCH 3/3] test: preserve writeToDisk overrides --- tests/index.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/index.test.ts b/tests/index.test.ts index a58e9a63..8452bebd 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -72,6 +72,19 @@ describe('pluginReactRouter', () => { ).toBe(false); }); + it('preserves an explicit writeToDisk override', async () => { + const rsbuild = await createStubRsbuild({ + rsbuildConfig: { + dev: { writeToDisk: true }, + }, + }); + + rsbuild.addPlugins([pluginReactRouter()]); + const config = await rsbuild.unwrapConfig(); + + expect(config.dev.writeToDisk).toBe(true); + }); + it('adds the committed custom-server build entry only in development', async () => { const devRsbuild = await createStubRsbuild({ rsbuildConfig: {} }); devRsbuild.addPlugins([pluginReactRouter({ customServer: true })]);