Skip to content

Commit c9c8cdb

Browse files
yusukebeNEKOYASAN
andcommitted
feat(server): avoid extglobs for rolldown-vite (#351)
* feat(server): avoid brace expansion and extglobs for rolldown-vite * use `{}` syntax Co-authored-by: NEKOYASAN <[email protected]>
1 parent ad86370 commit c9c8cdb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/server/with-defaults.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ export const createApp = <E extends Env>(options?: ServerOptions<E>) => {
88
app: options?.app,
99
init: options?.init,
1010
trailingSlash: options?.trailingSlash,
11+
// Avoid extglobs for rolldown-vite compatibility
12+
// ref: https://github.com/vitejs/rolldown-vite/issues/365
1113
NOT_FOUND:
1214
options?.NOT_FOUND ??
13-
import.meta.glob('/app/routes/**/_404.(ts|tsx)', {
15+
import.meta.glob('/app/routes/**/_404.{ts,tsx}', {
1416
eager: true,
1517
}),
1618
ERROR:
1719
options?.ERROR ??
18-
import.meta.glob('/app/routes/**/_error.(ts|tsx)', {
20+
import.meta.glob('/app/routes/**/_error.{ts,tsx}', {
1921
eager: true,
2022
}),
2123
RENDERER:
@@ -25,15 +27,20 @@ export const createApp = <E extends Env>(options?: ServerOptions<E>) => {
2527
}),
2628
MIDDLEWARE:
2729
options?.MIDDLEWARE ??
28-
import.meta.glob('/app/routes/**/_middleware.(ts|tsx)', {
30+
import.meta.glob('/app/routes/**/_middleware.{ts,tsx}', {
2931
eager: true,
3032
}),
3133
ROUTES:
3234
options?.ROUTES ??
3335
import.meta.glob(
3436
[
35-
'/app/routes/**/!(_*|-*|$*|*.test|*.spec).(ts|tsx|md|mdx)',
36-
'/app/routes/.well-known/**/!(_*|-*|$*|*.test|*.spec).(ts|tsx|md|mdx)',
37+
'/app/routes/**/*.{ts,tsx,md,mdx}',
38+
'/app/routes/.well-known/**/*.{ts,tsx,md,mdx}',
39+
'!/app/routes/**/_*.{ts,tsx,md,mdx}',
40+
'!/app/routes/**/-*.{ts,tsx,md,mdx}',
41+
'!/app/routes/**/$*.{ts,tsx,md,mdx}',
42+
'!/app/routes/**/*.test.{ts,tsx}',
43+
'!/app/routes/**/*.spec.{ts,tsx}',
3744
'!/app/routes/**/-*/**/*',
3845
],
3946
{

0 commit comments

Comments
 (0)