Skip to content

Commit 568bbc5

Browse files
authored
add turbopack resolveAlias fs fallback for nextjs 16 (#58390)
1 parent 5316456 commit 568bbc5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

empty.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Empty module to satisfy Turbopack resolveAlias fallback for Node.js modules
2+
// See turbopack config in next.config.ts
3+
export default {}

next.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,21 @@ const config: NextConfig = {
4747
}
4848
})
4949
},
50+
5051
// Turbopack is the default bundler in Next.js 16
5152
// Keep webpack config for now to support both bundlers
52-
turbopack: {},
53+
54+
// Turbopack configuration for Next.js 16 (replaces webpack fallbacks)
55+
turbopack: {
56+
resolveAlias: {
57+
fs: {
58+
browser: './empty.ts', // Point to empty module when fs is requested for browser
59+
},
60+
async_hooks: {
61+
browser: './empty.ts', // Point to empty module when async_hooks is requested for browser
62+
},
63+
},
64+
},
5365

5466
webpack: (webpackConfig) => {
5567
webpackConfig.experiments = webpackConfig.experiments || {}

0 commit comments

Comments
 (0)