Skip to content

Commit

Permalink
fix: exclude /^\/app\/.+\.tsx?/ in vite dev-server (#251)
Browse files Browse the repository at this point in the history
* fix: exclude `/^\/app\/.+\.tsx?/` in vite dev-server

* correct the test
  • Loading branch information
yusukebe authored Jan 10, 2025
1 parent a3956ea commit 5ac6155
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions mocks/app/routes/app/nested/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function () {
return <h1>Nested</h1>
}
2 changes: 1 addition & 1 deletion src/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function honox(options?: Options): PluginOption[] {
entry,
exclude: [
...devServerDefaultOptions.exclude,
/^\/app\/.+/,
/^\/app\/.+\.tsx?/,
/^\/favicon.ico/,
/^\/static\/.+/,
],
Expand Down
6 changes: 6 additions & 0 deletions test-e2e/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
6 changes: 5 additions & 1 deletion test-integration/apps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ describe('Basic', () => {
path: '/throw_error',
method: 'GET',
},
{
path: '/app/nested',
method: 'GET',
},
]
expect(app.routes).toHaveLength(46)
expect(app.routes).toHaveLength(48)
expect(app.routes).toEqual(
expect.arrayContaining(
routes.map(({ path, method }) => {
Expand Down

0 comments on commit 5ac6155

Please sign in to comment.