Dynamic import's module's internal wasm fails to load

I’m trying to use this physics library which is necessarily loaded dynamically:

Because Rapier is actually a WebAssembly module, it has to be loaded asynchronously. The following shows a basic example with a dynamic rigid-body falling on the ground.

I’ve successfully loaded other modules dynamically by following the Meteor docs on the topic but am having trouble doing so for this particular library.

I’ve got a file called dynamic-imports-whitelist.js which has the following code:

import 'dynamic-import-whitelist.js'

if (false) {
	// ...other imports...
	import('@dimforge/rapier3d')
	//import('rapier_wasm3d_bg.wasm') // ** see below
	//import('./rapier_wasm3d_bg.wasm') // **
	//import('@dimforge/rapier3d/rapier_wasm3d_bg.wasm') // **
}

Then I’ve got some code in an async function, in a file which statically imports dynamic-import-whitelist.js:

		const rapier = await import('@dimforge/rapier3d')

Executing this code creates an exception:

Error: Cannot find module './rapier_wasm3d_bg.wasm'

** Uncommenting these lines does not help.

Any suggestions? Thank you!

Just want to bump this. benjamn, any ideas? Pinging you since you’d answered some related questions in this thread. :slight_smile: Thank you.

@mak, perhaps you have some suggestions? Or anyone? Would appreciate any help here. Thank you all.