From 54595b0f1204264bc2170c0958dcd44611c3fe6f Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Fri, 10 Jan 2025 17:38:02 +0900 Subject: [PATCH] fix: exclude `/^\/app\/.+\.tsx?/` in vite dev-server --- mocks/app/routes/app/nested/index.tsx | 3 +++ src/vite/index.ts | 2 +- test-e2e/e2e.test.ts | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 mocks/app/routes/app/nested/index.tsx diff --git a/mocks/app/routes/app/nested/index.tsx b/mocks/app/routes/app/nested/index.tsx new file mode 100644 index 0000000..9902cd3 --- /dev/null +++ b/mocks/app/routes/app/nested/index.tsx @@ -0,0 +1,3 @@ +export default function () { + return

Nested

+} diff --git a/src/vite/index.ts b/src/vite/index.ts index 7a6441c..72c859e 100644 --- a/src/vite/index.ts +++ b/src/vite/index.ts @@ -33,7 +33,7 @@ function honox(options?: Options): PluginOption[] { entry, exclude: [ ...devServerDefaultOptions.exclude, - /^\/app\/.+/, + /^\/app\/.+\.tsx?/, /^\/favicon.ico/, /^\/static\/.+/, ], diff --git a/test-e2e/e2e.test.ts b/test-e2e/e2e.test.ts index 2691c49..04ff231 100644 --- a/test-e2e/e2e.test.ts +++ b/test-e2e/e2e.test.ts @@ -131,3 +131,9 @@ test('server-side suspense contains island components', async ({ page }) => { await container.getByText('Count: 7').click() await container.getByText('Suspense Islands').click() }) + +test('/app/nested', async ({ page }) => { + await page.goto('/app/nested') + const contentH1 = await page.textContent('h1') + expect(contentH1).toBe('Nested') +})