Saturday, 13 May 2017

Module not found: Error: Can't resolve 'fs'

I'm trying to migrate my build from gulp to Webpack 2. Some background: this is a client + server project, so there is a tiny express server which serves up the client files and also serves as a backend for REST calls. In the Webpack version the express server will also run the webpack middleware (in development only).

Now, when I'm starting the server (and webpack middleware) up, I'm getting this error:

ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Can't resolve 'fs' in '/development/layrz/annotations/node_modules/xmlhttprequest/lib'
 @ ./~/xmlhttprequest/lib/XMLHttpRequest.js 16:9-22
 @ ./~/d3-request/build/d3-request.node.js
 @ ./client/scripts/utils/Utils.js
 @ ./client/scripts/components/account/accountPage.js
 @ ./client/scripts/app.js
 @ multi webpack-hot-middleware/client ./client/scripts/app.js

I tried targeting Node, but then I run into problems around require not being found.

Also, providing the 'node' config object didn't solve the issue.



via Janos

No comments:

Post a Comment