diff --git a/website/src/docs/MiniRepl.jsx b/website/src/docs/MiniRepl.jsx index 425d18a3..d6a325ff 100644 --- a/website/src/docs/MiniRepl.jsx +++ b/website/src/docs/MiniRepl.jsx @@ -3,8 +3,9 @@ import { initAudioOnFirstClick } from '@strudel.cycles/webaudio'; import { useEffect, useState } from 'react'; import { prebake } from '../repl/prebake'; +let modules; if (typeof window !== 'undefined') { - evalScope( + modules = evalScope( controls, import('@strudel.cycles/core'), // import('@strudel.cycles/tone'), @@ -27,9 +28,9 @@ export function MiniRepl({ tune, drawTime, punchcard, canvasHeight = 100 }) { useEffect(() => { // we have to load this package on the client // because codemirror throws an error on the server - import('@strudel.cycles/react').then((res) => { - setRepl(() => res.MiniRepl); - }); + Promise.all([import('@strudel.cycles/react'), modules]) + .then(([res]) => setRepl(() => res.MiniRepl)) + .catch((err) => console.error(err)); }, []); return Repl ? (