I was trying to use browserify on a file that uses the fs object. When I browserify it, the call to require(\'fs\') doesn\'t get transformed and require>
Is it necessary for you to use require (fs) , you could always use html5 file reader api to read files in javascript.
window.onload = function() {
var fileInput1 = document.getElementById('fileInput');
if (fileInput1){
fileInput1.addEventListener('change', function(e) {
var file = fileInput1.files[0];
var textType = /text.*/;
if (file.type.match(textType)) {
var reader = new FileReader();
reader.onload = function(e) {
console.log(reader.result);
}
reader.readAsText(file);
}
});
}
}
you will also have to insert a input file in the html side.