Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Cannot resolve module fs #173

Closed
rspt opened this issue Apr 7, 2016 · 3 comments
Closed

Cannot resolve module fs #173

rspt opened this issue Apr 7, 2016 · 3 comments

Comments

@rspt
Copy link

rspt commented Apr 7, 2016

Hello!

I ran into this error just after installing the wpcom lib (via npm) and trying to bundle it using webpack:

ERROR in ./~/wpcom/dist/lib/site.media.js
Module not found: Error: Cannot resolve module 'fs' in /Users/xxx/client/node_modules/wpcom/dist/lib
 @ ./~/wpcom/dist/lib/site.media.js 4:9-22

Note this error disappear if I install the fsmodule via npm

@retrofox
Copy link
Contributor

retrofox commented Apr 7, 2016

Here is an webpack issue talking about. You could add "browser": { "fs": false } to solve it.
https://github.com/Automattic/wpcom.js/blob/master/webpack.config.js#L4-L6

@oskosk
Copy link
Contributor

oskosk commented Apr 7, 2016

I can assert that adding this to my project's main webpack.config.js did the trick

  node: {
    fs: 'empty'
  },

@retrofox retrofox closed this as completed Apr 7, 2016
@rspt
Copy link
Author

rspt commented Apr 7, 2016

Yes thanks a lot for the answer. It still seems to me a little bit odd to add something in my config or to install a package to make one works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants