kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 195 forks source link

Ignoring NPM Packages Server Side #628

Closed jaysig closed 8 years ago

jaysig commented 8 years ago

I am trying to use the NPM Package Packery within my app, but its saying window is not defined. I'm assuming this is because the window does not exist on the server. I'm wondering if there's someway to disable the package on the server or if someone has a better workaround?

jaysig commented 8 years ago

Just realized this fixes it

React Starter Issue

const isBrowser = typeof window !== 'undefined';
const MyWindowDependentLibrary = isBrowser ? require( 'path/to/library') : undefined;