I have created a Threejs project and i am using Rapier Physics in it. Now the whole projects is working perfectly in development. But once i build it and then do npm run preview i got the followimg error.
index-BPEdORCD.js:3827 Uncaught TypeError: Cannot read properties of undefined (reading 'rawintegrationparameters_new')
at new sr (index-BPEdORCD.js:3827:85073)
at new dv (index-BPEdORCD.js:3827:131097)
at new la (index-BPEdORCD.js:3827:159423)
at eS (index-BPEdORCD.js:3924:71362)
at index-BPEdORCD.js:3924:86781
at index-BPEdORCD.js:1:23
at index-BPEdORCD.js:3924:90288
I have tried various ways like loading wasm but not getting problem resolved
Edit: v0.15.0
was released on March 6, 2025, so there is no longer a need to include the treeshake
solution mentioned below.
Previous answer: This error will be resolved after Rapier.js is updated after v0.14.0
.
In the meantime, you can add the following code to your vite.config.js
file to disable treeshaking when the app is built.
build: {
rollupOptions: {
treeshake: false
}
}
}