wilsonpage / fastdom

Eliminates layout thrashing by batching DOM measurement and mutation tasks
6.83k stars 240 forks source link

Failure in node #92

Closed tusharmath closed 8 years ago

tusharmath commented 8 years ago
/Users/tushar.mathur/Documents/Projects/funag/node_modules/fastdom/fastdom.js:242
})( window || this);
    ^

ReferenceError: window is not defined
    at Object.<anonymous> (/Users/tushar.mathur/Documents/Projects/funag/node_modules/fastdom/fastdom.js:242:5)
    at Module._compile (module.js:541:32)
    at Module._extensions..js (module.js:550:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/tushar.mathur/Documents/Projects/funag/node_modules/babel-register/lib/node.js:156:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
wilsonpage commented 8 years ago

This could be replaced with:

})( typeof window !== 'undefined' ? window : this);

Will accept a pull-request :)

wilsonpage commented 8 years ago

Just out of interest, why would you use fastdom in node?

tusharmath commented 8 years ago

@wilsonpage How about using — https://www.npmjs.com/package/window-or-global instead?

tusharmath commented 8 years ago

I am not technically using it, I just import a couple of modules which in turn import fastdom.