rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.88k stars 160 forks source link

SSR #113

Closed fluse closed 4 years ago

fluse commented 5 years ago

if i use some server side rendered single page frameworks like react and include it with import, i got following error

window is not defined 6|K117 | at Object. ({pathToProject}/node_modules/web-audio-daw/build/webpack:/Wad/webpack/universalModuleDefinition:10:2)

You should add a check for window is available for server rendering reasons

rserota commented 4 years ago

I'm not exactly sure what you expect me to do here? Wad.js runs in the browser, and cares very much about the window. When Wad.js loads initially, it creates an audio context, sets event handlers, requests device access, and other tasks that don't make sense on a server. Can't you just defer loading Wad.js until it's running on the client?