loading ammo.js with react.js

297 views Asked by At

I have a custom ammo.js build in my reactjs app I want to load , in typescript. unfortunately it does not work.

I had to inhibit eslint, prettier to not apply it with ammojs api.

reactjs v16

import * as Ammo from './ammo.js';
Ammo().then (console.log('ammojs loaded'));

I have this error :

Failed to compile
/home/sancelot/git/courbes-simulation/src/components/Child.tsx
TypeScript error in /home/sancelot/git/courbes-simulation/src/components/Child.tsx(10,1):
This expression is not callable.
Type 'typeof Ammo' has no call signatures. TS2349
8 | // @ts-ignore
9 | import * as Ammo from './ammo.js';

10 | Ammo().then (console.log('ammojs loaded'));
| ^
11 |
12 |
13 | type Props = {
This error occurred during the build time and cannot be dismissed.

1

There are 1 answers

0
sancelot On

Since this an error compilation, adding @ts-ignore solved the problem.