Skip to content

Commit 6a690d7

Browse files
authored
Merge pull request #399 from zh-lx/fix/files-scope-for-nextjs
fix: improve the file scope of nextjs
2 parents 8eb06f2 + ced8861 commit 6a690d7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

packages/turbopack/src/index.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,32 @@ 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+
3862
return {
39-
'**/app/**/*.{jsx,tsx,js,ts,mjs,mts}': {
63+
[matchFiles]: {
4064
loaders: [
4165
{
4266
loader: `${WebpackDistDir}/loader.js`,

0 commit comments

Comments
 (0)