Skip to content

Commit 1838227

Browse files
authored
Merge pull request #398 from lars-hagen/fix/turbopack-default-pattern
fix(turbopack): restrict default pattern to app directory to prevent middleware crashes
2 parents 7306cfd + 3ac00fe commit 1838227

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

demos/turbopack-next15/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"react": "19.1.0",
13-
"react-dom": "19.1.0",
14-
"next": "15.4.4"
12+
"next": "15.5.3",
13+
"react": "19.1.1",
14+
"react-dom": "19.1.1"
1515
},
1616
"devDependencies": {
17-
"typescript": "^5",
18-
"@types/node": "^20",
19-
"@types/react": "^19",
20-
"@types/react-dom": "^19",
21-
"@tailwindcss/postcss": "^4",
22-
"tailwindcss": "^4",
23-
"eslint": "^9",
24-
"eslint-config-next": "15.4.4",
25-
"@eslint/eslintrc": "^3",
17+
"@eslint/eslintrc": "^3.3.1",
18+
"@mdx-js/loader": "^3.1.1",
19+
"@next/mdx": "15.5.3",
20+
"@tailwindcss/postcss": "^4.1.13",
21+
"@types/node": "^24.3.1",
22+
"@types/react": "^19.1.12",
23+
"@types/react-dom": "^19.1.9",
2624
"code-inspector-plugin": "workspace:^",
27-
"@next/mdx": "15.4.4",
28-
"@mdx-js/loader": "^3.1.0"
25+
"eslint": "^9.35.0",
26+
"eslint-config-next": "15.5.3",
27+
"tailwindcss": "^4.1.13",
28+
"typescript": "^5.9.2"
2929
}
3030
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Middleware file to verify turbopack compatibility
2+
//
3+
// ⚠️ This file should be REMOVED once Turbopack fixes the middleware issue ⚠️
4+
//
5+
// With the improved pattern '**/app/**/*.{jsx,tsx,js,ts,mjs,mts}' in the turbopack plugin,
6+
// code-inspector only processes files in app directories, naturally excluding middleware files.
7+
// This prevents the Turbopack crash issue by default.
8+
//
9+
// This is still a workaround. Track the issues for removal:
10+
// - https://github.com/vercel/next.js/issues/79592
11+
// - https://github.com/zh-lx/code-inspector/issues/357
12+
13+
export function middleware() {
14+
// Empty middleware - its presence is enough to test the workaround
15+
}

packages/turbopack/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function TurbopackCodeInspectorPlugin(
3636
const WebpackDistDir = path.resolve(WebpackEntry, '..');
3737

3838
return {
39-
'**/*.{jsx,tsx,js,ts,mjs,mts}': {
39+
'**/app/**/*.{jsx,tsx,js,ts,mjs,mts}': {
4040
loaders: [
4141
{
4242
loader: `${WebpackDistDir}/loader.js`,

0 commit comments

Comments
 (0)