Suppose to reopen issue #91. Breaking bug I think
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 ?
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: https://github.com/pugjs/pug-loader/issues/8#issuecomment-55568520)
..which was already suggested in the previous issue #91. Did you actually try that?
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 ;)
That _might_ be the problem as it can't work...
Closing this as a "solution" was identified ;)
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.
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.
It's not impossible if you are on a CEP VM, like the HTML5 Adobe Extension do.
The problem is real
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.
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
Most helpful comment
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