fix(web): add browser fs fallback in Next webpack config

Prevent client builds from resolving Node's fs module when loading html-to-docx in workspace editors.
This commit is contained in:
kumarabhirup 2026-03-04 11:07:31 -08:00
parent cd7ea43a91
commit bc6a4d5a37
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -19,7 +19,13 @@ const nextConfig: NextConfig = {
// Transpile ESM-only packages so webpack can bundle them
transpilePackages: ["react-markdown", "remark-gfm"],
webpack: (config, { dev }) => {
webpack: (config, { dev, isServer }) => {
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
}
if (dev) {
config.watchOptions = {
...config.watchOptions,