Error AtlasError Documentation and Resolution

Vite externalized a Node.js module for browser compatibility

Module "fs" has been externalized for browser compatibility. Cannot access "fs.readFile" in client code.

Vite detected Node.js-only module usage in browser code and externalized it instead of bundling it into the client build.

Module "fs" has been externalized for browser compatibility.build errors
Module "fs" has been externalized for browser compatibility. Cannot access "fs.readFile" in client code.
  • Browser code imports a Node.js built-in module like `fs` or `path`.
  • A third-party dependency intended for Node.js is being bundled into the client.
  • Server-only logic was accidentally moved into shared frontend code.
  1. Remove Node.js built-ins from code that runs in the browser.
  2. Move server-only logic behind an API or server runtime boundary.
  3. Replace the dependency with a browser-compatible alternative if the code must run client-side.
Vite: Troubleshooting
Vite module externalized for browser compatibility: causes and fixes | Error Atlas