The fs is an empty object in my app.
I am using Angular2 cli which uses webpack to bundle up the application.
I am using the file-exists package in my app - https://www.npmjs.com/package/file-exists.
So in my component.ts file, I have this line:
let fileExists = require('file-exists');
file-exists, depends on
fs. There is no webpack polyfill for
fs and there wouldn't be a good way to add one either. Therefore webpack can't export
file-exists for client-side web usage. See this list for supported, native, node modules that can be polyfilled.