Uncaught ReferenceError: require is not defined javascript error

This question is very common one, however none of the solution had worked for me.
I am trying to use “require” to file system module but I keep runnig to this error.
Uncaught ReferenceError: require is not defined

const fs = require('fs');

I realize that I need to use browserify to get “require” to work on client side so I installed it but no luck.