Check if window.module is available before setting module.exports