How can I require the package 'fs' on the server only and on the client resolve null?
If you try to run this on the client:
Module not found: Can't resolve 'fs'
(The potential duplicate question How to check whether a script is running under node.js? does not answer this problem)
const isNode =
typeof process !== 'undefined' &&
process.versions != null &&
process.versions.node != null;
const fs = isNode && require('fs');