Have no idea why this is the case, but wrapping the window.require line in
window.require
if (typeof window !== 'undefined') {}
fixed it.