Open dghez opened 1 month ago
As a workaround just call resume @dghez
const { onLoop, resume } = useRenderLoop();
console.log('BOX: GENERATE');
onLoop((state) => {
if (mesh.value) {
mesh.value.position.x = Math.sin(state.elapsed);
}
});
resume();
https://stackblitz.com/edit/nuxt-starter-s6xuwx?file=components/Box.vue,package.json
For the lazy people, I've made an explicit composable
so i'm sure I won't forget to call the resume
import { useRenderLoop } from '@tresjs/core'
export const useCustomFrame = (cb) => {
const { onLoop, resume } = useRenderLoop()
onLoop((state) => {
cb(state)
})
resume()
}
I'm using
nuxt
withSSG
, so runningnuxt generate
to build it, I noticed this thing, everything works fine in dev mode, but when i build usinggenerate
theonLoop
function never get called. Attached I have the reproduction linkI'm running on
DEV MODE, as you can see it triggers the logs correctly, including the loop
BUILD, the
onLoop
never get triggeredReproduction
https://stackblitz.com/edit/nuxt-starter-hsw5j9
Steps to reproduce
npm i
npm run dev
npm run generate
System Info
Used Package Manager
npm
Code of Conduct