Skip to content

Commit e9357fe

Browse files
heiskrCopilot
andauthored
Fix Turbopack fs.promises stub for local dev (#60595)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2751fc1 commit e9357fe

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

next.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ const config: NextConfig = {
7070
turbopack: {
7171
resolveAlias: {
7272
fs: {
73-
browser: './empty.ts', // Point to empty module when fs is requested for browser
73+
browser: './stub.ts',
7474
},
7575
async_hooks: {
76-
browser: './empty.ts', // Point to empty module when async_hooks is requested for browser
76+
browser: './stub.ts',
7777
},
7878
'@/observability/logger': {
79-
browser: './empty.ts',
79+
browser: './stub.ts',
8080
},
8181
'@/observability/logger/lib/logger-context': {
82-
browser: './empty.ts',
82+
browser: './stub.ts',
8383
},
8484
'@/observability/lib/tracing': {
8585
browser: './src/observability/lib/tracing.browser.ts',

empty.ts renamed to stub.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Empty module to satisfy Turbopack resolveAlias fallback for Node.js modules
1+
// Stub module to satisfy Turbopack resolveAlias fallback for Node.js modules
22
// See turbopack config in next.config.ts
33

44
// No-op function that returns itself for chaining
@@ -9,4 +9,7 @@ export const createLogger = () => ({
99
debug: () => {},
1010
})
1111

12+
// Stub for fs.promises (used by server-only code that Turbopack traces into client bundles)
13+
export const promises = {}
14+
1215
export default {}

0 commit comments

Comments
 (0)