Skip to content

Commit 50b9ea2

Browse files
committed
fix(build): add webpack config for Node.js module fallbacks
- Configure webpack to exclude fs and path modules from browser builds - Works with parser's conditional fs import for browser compatibility - Enables successful Next.js build with parser v1.2.0 This fix allows the website to build while parser retains @include directive functionality for CLI users.
1 parent 831ecad commit 50b9ea2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

next.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ const nextConfig = {
66
},
77
basePath: '',
88
trailingSlash: true,
9+
webpack: (config, { isServer }) => {
10+
// For client-side builds, disable Node.js modules (fs, path, etc.)
11+
// Parser uses conditional require('fs') which gracefully fails in browser
12+
if (!isServer) {
13+
config.resolve.fallback = {
14+
...config.resolve.fallback,
15+
fs: false,
16+
path: false,
17+
};
18+
}
19+
return config;
20+
},
921
}
1022

1123
module.exports = nextConfig

0 commit comments

Comments
 (0)