What might cause a bundler like Webpack or Parcel to throw this error?

Question

Grade: Education Subject: Support
What might cause a bundler like Webpack or Parcel to throw this error?
Asked by:
70 Viewed 70 Answers

Answer (70)

Best Answer
(356)
Bundlers like Webpack or Parcel are designed to package frontend code for browsers. If they encounter an `import fs from 'fs';` statement, they'll try to resolve it, fail, and throw the 'module not found' error because 'fs' is a Node.js global. You might need to configure your bundler to ignore or polyfill such modules if they are inadvertently included.