How to fix "Dynamic require of 'fs' is not supported" error in Next.js projects

Last updated: October 8, 2025

If you encounter an error message stating "Dynamic require of 'fs' is not supported" in your Next.js project, particularly when using Uniform packages, with Next.js in ESM syntax (next.config.mjs) instead of CommonJS (next.config.js).

.../node_modules/@uniformdev/canvas-next-rsc/dist/config.mjs:5
throw Error( 'Dynamic require of "' + x + '" is not supported');
Error: Dynamic require of "fs" is not supported
at .../node_modules/@uniformdev/canvas-next-rsc/dist/config.mjs:5:9
at .../neom-the-line/node_modules/@uniformdev/canvas-next-rsc/dist/config.mjs:10:22
at ModuleJob. run (node: internal/modules/esm/module_job: 235:25)
at async ModuleLoader. import (node: internal/modules/esm/loader: 461:24)
at async loadConfig (.../node_modules/next/dist/server/config-js:698:36) at async Module.nextDev

Solution:

We recommend updating the NPM packages. Contact support to create a ticket for details.