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
5 changes: 5 additions & 0 deletions .changeset/quiet-disks-rest.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 0 additions & 4 deletions examples/default-template/tests/e2e/dev-route-watch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ export const pluginReactRouter = (
assetPrefix: config.output?.assetPrefix || '/',
},
dev: {
writeToDisk: true,
...lazyCompilation,
watchFiles: mergeWatchFiles(config.dev?.watchFiles, routeWatchFiles),
},
Expand Down
2 changes: 1 addition & 1 deletion tests/features.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
15 changes: 14 additions & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 })]);
Expand Down
Loading