Skip to content

Commit bf3f687

Browse files
committed
fix(turbopack): restore full pattern and remove middleware crash workaround
1 parent 6680218 commit bf3f687

File tree

4 files changed

+33
-52
lines changed

4 files changed

+33
-52
lines changed

demos/turbopack-next15/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"next": "15.5.3",
12+
"next": "15.6.0-canary.38",
1313
"react": "19.1.1",
1414
"react-dom": "19.1.1"
1515
},
1616
"devDependencies": {
1717
"@eslint/eslintrc": "^3.3.1",
1818
"@mdx-js/loader": "^3.1.1",
19-
"@next/mdx": "15.5.3",
19+
"@next/mdx": "15.6.0-canary.38",
2020
"@tailwindcss/postcss": "^4.1.13",
21-
"@types/node": "^24.3.1",
22-
"@types/react": "^19.1.12",
21+
"@types/node": "^24.6.1",
22+
"@types/react": "^19.1.16",
2323
"@types/react-dom": "^19.1.9",
2424
"code-inspector-plugin": "workspace:^",
25-
"eslint": "^9.35.0",
26-
"eslint-config-next": "15.5.3",
25+
"eslint": "^9.36.0",
26+
"eslint-config-next": "15.6.0-canary.38",
2727
"tailwindcss": "^4.1.13",
28-
"typescript": "^5.9.2"
28+
"typescript": "^5.9.3"
2929
}
3030
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
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
1+
// Middleware file to verify code-inspector works with middleware present
2+
//
3+
// This file proves that code-inspector is compatible with Next.js middleware.
4+
// The middleware crash bug existed in Next.js 15.4.4 and below but has been
5+
// fixed in Next.js 15.6.0-canary.38 and later versions.
126

137
export function middleware() {
14-
// Empty middleware - its presence is enough to test the workaround
8+
// Empty middleware - its presence is enough to verify compatibility
159
}
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"compilerOptions": {
33
"target": "ES2017",
4-
"lib": ["dom", "dom.iterable", "esnext"],
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
59
"allowJs": true,
610
"skipLibCheck": true,
711
"strict": true,
@@ -11,17 +15,26 @@
1115
"moduleResolution": "bundler",
1216
"resolveJsonModule": true,
1317
"isolatedModules": true,
14-
"jsx": "preserve",
18+
"jsx": "react-jsx",
1519
"incremental": true,
1620
"plugins": [
1721
{
1822
"name": "next"
1923
}
2024
],
2125
"paths": {
22-
"@/*": ["./src/*"]
26+
"@/*": [
27+
"./src/*"
28+
]
2329
}
2430
},
25-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26-
"exclude": ["node_modules"]
31+
"include": [
32+
"next-env.d.ts",
33+
"**/*.ts",
34+
"**/*.tsx",
35+
".next/types/**/*.ts"
36+
],
37+
"exclude": [
38+
"node_modules"
39+
]
2740
}

packages/turbopack/src/index.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,24 @@ export function TurbopackCodeInspectorPlugin(
3535
}
3636
const WebpackDistDir = path.resolve(WebpackEntry, '..');
3737

38-
// according to: https://nextjs.org/docs/app/getting-started/project-structure#routing-files
39-
const validFiles = [
40-
'*.jsx',
41-
'*.tsx',
42-
'layout.js',
43-
'layout.ts',
44-
'page.js',
45-
'page.ts',
46-
'loading.js',
47-
'loading.ts',
48-
'not-found.js',
49-
'not-found.ts',
50-
'error.js',
51-
'error.ts',
52-
'global-error.js',
53-
'global-error.ts',
54-
'template.js',
55-
'template.ts',
56-
'default.js',
57-
'default.ts',
58-
];
59-
60-
const matchFiles = `**/{${validFiles.join(',')}}`;
61-
6238
return {
63-
[matchFiles]: {
39+
'**/*.{jsx,tsx,js,ts,mjs,mts}': {
6440
loaders: [
6541
{
6642
loader: `${WebpackDistDir}/loader.js`,
6743
options: {
6844
...options,
6945
record,
7046
},
71-
...(options.enforcePre === false ? {} : { enforce: 'pre' }),
7247
},
7348
{
7449
loader: `${WebpackDistDir}/inject-loader.js`,
7550
options: {
7651
...options,
7752
record,
7853
},
79-
enforce: 'pre',
8054
},
8155
],
8256
},
8357
};
84-
}
58+
}

0 commit comments

Comments
 (0)