Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using this breaks fs #3988

Closed
RyanMitchellWilson opened this issue Feb 6, 2018 · 2 comments
Closed

Using this breaks fs #3988

RyanMitchellWilson opened this issue Feb 6, 2018 · 2 comments

Comments

@RyanMitchellWilson
Copy link

RyanMitchellWilson commented Feb 6, 2018

I used this following the instructions on the site, but now whenever I need to install anything that uses fs such as https://github.com/jprichardson/node-jsonfile and https://github.com/sindresorhus/write-json-file or even just trying to use fs doesn't work. Every single time fs is called it says fs.whatever is not a function.

When I try to console log out fs it just prints an empty object. Something in here is getting rid of fs.

React 16.2.0

@gaearon
Copy link
Contributor

gaearon commented Feb 7, 2018

How do you expect fs to work in the browser? It’s a Node-only API. You can import many modules that work in the browser, but there’s no possible way for modules that rely on fs to do so.

Note that this project doesn’t give you a Node server. Its output is a static HTML/JS/CSS bundle, compatible with any web server. If you’re looking to run a Node.js server and use Node APIs from it, that’s fine, but then you don’t need to put those calls into the client code.

I hope this helps!

@gaearon gaearon closed this as completed Feb 7, 2018
@RyanMitchellWilson
Copy link
Author

Ya it does, I wasn't aware that fs didn't work in a browser. Thanks for the quick reply

@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
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

2 participants