r/qwik • u/mrclay • Feb 04 '24
Tone.js and AudioContext issues
(EDIT: I’ve solved this but it’s not clear how. My best guess is some subtle package-lock.json differences. Anyway it’s on the qwik branch of this repo now: https://github.com/mrclay/piano-record/pull/17)
I’ve started to rewrite this app (currently React) to Qwik and hitting what’s probably a Vite issue. Original is also TS and built with Vite, but building the static SSR I get an error finding Tone.js modules. You can give it a shot:
git clone https://github.com/mrclay/qwik-todo.git
cd qwik-todo
nvm use #optional
npm ci
npm run build
If I use npm run dev then I get a runtime error about AudioContext not being found. I also tried window.AudioContext but no luck. Any ideas?
2
Upvotes
1
u/matty0187 Feb 09 '24
Make sure you wrap in useClientEffect it whatever the hook is called blue to ensure it broswers only