viridia / demo-rapier-three

Demonstration of three.js working with rapier3d.js
MIT License
74 stars 4 forks source link

updating to @dimforge/rapier3d@0.12.0 error : Uncaught (in promise) TypeError: i is undefined #55

Closed Sean-Bradley closed 3 months ago

Sean-Bradley commented 3 months ago

With @dimforge/rapier3d@0.11.2 as is used in this current repo.

npm run build then npx vite preview is OK

But if updating to latest rapier3d@0.12.0

npm install @dimforge/rapier3d@latest --save-dev

npm run build then npx vite preview fails with error

image

If i downgrade it works again

npm install @dimforge/rapier3d@0.11.2 --save-dev

npm run build then npx vite preview is OK

viridia commented 3 months ago

Well, I upgraded and got the error you mentioned. The error appears when first initializing rapier, so it's possible that something in the rapier API got changed.

Unfortunately, that's about all I can determine. I don't know if there's a migration guide which explains what changed in 0.12.0. I haven't been doing much JavaScript programming in the last year (I've been working in Rust) so I haven't paid much attention to rapier.js.

Sean-Bradley commented 3 months ago

Thanks, anyway. I will continue with version 0.11.2 for now since it works pretty good anyway. I will keep looking around for clues either way.

Sean-Bradley commented 3 months ago

To let you know, I solved it by using @dimforge/rapier3d-compat@.12.0 instead.

npm run build then npx vite preview now works for v0.12.0

I am happy to create a pull request for this if you want.

viridia commented 3 months ago

Unfortunately, one of the purposes of this "example" project is to demonstrate how to use Rapier without needing to resort to the "compat" option. As you probably know, rapier-compat doesn't take advantage of the WASM-loading features of the bundler, and instead uses a binhex-encoded binary blob, which is significantly larger and therefore increases the loading time for the app.

Sean-Bradley commented 3 months ago

Ok, thanks. That makes sence. It's back to the drawing board for now.