Skip to content

Commit

Permalink
Fix default exlude patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Kish committed Oct 7, 2023
1 parent 98b7d81 commit 3775227
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/dev-server/src/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type DevServerOptions = {
export const defaultOptions: Required<Omit<DevServerOptions, 'cf'>> = {
entry: './src/index.ts',
injectClientScript: true,
exclude: ['.*.ts', '.*.tsx', '/@.+', '/node_modules/.*'],
exclude: ['.*\\.ts', '.*\\.tsx', '/@.+', '\\/node_modules\\/.*'],
}

interface ExecutionContext {
Expand Down
3 changes: 3 additions & 0 deletions packages/dev-server/test/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ test('Should exclude the file specified in the config file', async ({ page }) =>
let response = await page.goto('/file.ts')
expect(response?.status()).toBe(404)

response = await page.goto('/ends-in-ts')
expect(response?.status()).toBe(200)

response = await page.goto('/app/foo')
expect(response?.status()).toBe(404)
})
3 changes: 3 additions & 0 deletions packages/dev-server/test/mock/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ app.get('/file.ts', (c) => {
app.get('/app/foo', (c) => {
return c.html('<h1>exclude me!</h1>')
})
app.get('/ends-in-ts', (c) => {
return c.text('this should not be excluded')
})

export default app

0 comments on commit 3775227

Please sign in to comment.