1

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

3 Answers 3

0

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
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

0

In my case I got this error because I neglected to call RAPIER.init() before using the library.

The official docs have a good example:

import RAPIER from 'https://cdn.skypack.dev/@dimforge/rapier2d-compat';

RAPIER.init().then(() => {
    // Run the simulation.
});

// OR using the await syntax:
async function run_simulation() {
    await RAPIER.init();
    // Run the simulation.
    _run_simulation(RAPIER);
}
run_simulation()

Comments

0

I just downgraded rapier to lower version and it also worked

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.