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

'fs' not working #262

Closed
tvld opened this issue Sep 14, 2016 · 9 comments
Closed

'fs' not working #262

tvld opened this issue Sep 14, 2016 · 9 comments

Comments

@tvld
Copy link

tvld commented Sep 14, 2016

Suppose to reopen issue #91. Breaking bug I think

@tvld
Copy link
Author

tvld commented Sep 14, 2016

Problem same for vue init webpack and vue init webpack-simple
Very simple test:

vue init webpack testapp
cd testapp
npm install

add a line to main.js:

 const fs = require('fs')

and npm run dev
Am I really the only one with this issue ?

@LinusBorg
Copy link
Contributor

LinusBorg commented Sep 14, 2016

this is a webpack problem, googling this error message brought many results, the usual solution is appearantly to add this to the webpack conf:

node: {
  fs: "empty"
}

(See here, for example: pugjs/pug-loader#8 (comment))

..which was already suggested in the previous issue #91. Did you actually try that?

@tvld
Copy link
Author

tvld commented Sep 14, 2016

yes.. I tried that, and although webpack no longer complained, it still did not work...

But you know what? I realized I was trying to use 'fs' in...the browser... oops... should that be the problem? fs in server makes more sense ;)

@LinusBorg
Copy link
Contributor

That might be the problem as it can't work...

Closing this as a "solution" was identified ;)

@chandrasekarb
Copy link

chandrasekarb commented May 12, 2017

node: { fs: "empty" }

Using this above code error has been solved but

fs.writeFile('/home/react-hello-world/test.txt', 'aaa', function(err) { alert(err); });

fs.writeFile is not working please give any solution.

@LinusBorg
Copy link
Contributor

LinusBorg commented May 12, 2017

Well, you replaced fs with an empty module, so any fs methods will not work.

You cannot use fs in the browser, there is no solution to this, it's techincally impossible.

@elisandroesp
Copy link

It's not impossible if you are on a CEP VM, like the HTML5 Adobe Extension do.
The problem is real

@LinusBorg
Copy link
Contributor

Well I don't really know what a CEP VM is, it's definitely not the usecase this template was built for.

And generally this is a webpack problem, Vue won't solve that.

@elisandroesp
Copy link

After a lot of tests, I've found a simple solution to use the nodejs on the chrome machine:
adding this to webpack.prod.conf.js allowed me to use your template to create Adobe extensions:
{ ... target: "node-webkit" ... }

They run on a CEF, "Chromium Embedded Framework" (My mistake: not a CEP, not a VM). http://code.google.com/p/chromiumembedded/
More info about Adobe CEP:
https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_8.x/Documentation/CEP%208.0%20HTML%20Extension%20Cookbook.md#applications-integrated-with-cep

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

No branches or pull requests

4 participants