Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loader bug with vite #18

Open
drewp opened this issue Nov 6, 2023 · 3 comments
Open

loader bug with vite #18

drewp opened this issue Nov 6, 2023 · 3 comments

Comments

@drewp
Copy link

drewp commented Nov 6, 2023

I don't know the actual cause, but I am using vite FWIW.

import Ammo from "ammojs-typed";

loadAmmo = Ammo(Ammo);
ammo.js:978 Uncaught TypeError: Cannot set properties of undefined (setting 'Ammo')
    at ammo.js:978:325

Workaround:

import Ammo from "ammojs-typed";

loadAmmo = Ammo.bind(Ammo)(Ammo);
(success)

Here's my tsconfig:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "strict": true,
    "strictFunctionTypes": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,

    "allowJs": true,
    "declaration": true,
    "downlevelIteration": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "module": "ES6",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "ES6",
    "traceResolution": true,
    "useDefineForClassFields": false,

    "lib": ["es2022", "dom", "ES2019.Object"],
    "types": []
  },
  "include": ["src/**/*.ts"]
}

and selected dep versions:

    "@types/three": "^0.157.2",
    "ammojs-typed": "^1.0.6",
    "three": "^0.158.0",
    "vite": "^4.5.0"
  },
  "devDependencies": {
    "node-globals": "^0.1.5",
    "tslib": "^2.6.2",
    "typescript": "^5.2.2"
@wingandstache
Copy link

The workaround worked great for me. Nothing else was working, but that got the job done. Finally hours of suffering are over. Thank you.

@wingandstache
Copy link

I'm getting a similar error to before. Any ideas on how to solve this one?
Uncaught TypeError: Cannot read properties of undefined (reading 'emscripten_bind_btTransform_btTransform_0')

@xjown
Copy link

xjown commented May 1, 2024

I'm getting a similar error to before. Any ideas on how to solve this one? Uncaught TypeError: Cannot read properties of undefined (reading 'emscripten_bind_btTransform_btTransform_0')

I also encountered the same problem, have you solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants