I used typescript to introduce the GUI, and found that an error was reported. I don’t know why, and I also installed the required packages. What’s the matter?
“@babylonjs/core”: “^4.2.0”,
“@babylonjs/gui”: “^4.2.0”,
“@types/earcut”: “^2.1.1”,
“babylonjs”: “^4.2.0”,
“babylonjs-gui”: “^4.2.0”,
“ts-loader”: “^8.1.0”,
“typescript”: “^4.2.3”
hi @yocover welcome to the community! It looks like you have not installed everything in your package.json.
For the NPM imports you need to choose from either the ones that start with @babylonjs
or not. They both include typings.
So, if you are using ES6 ( Babylon.js ES6 support | Babylon.js Documentation):
"@babylonjs/core": "^4.2.0",
"@babylonjs/gui": "^4.2.0",
Otherwise import the “legacy” ones:
"babylonjs": "^4.2.0",
"babylonjs-gui": "^4.2.0",
There is a good TypeScript starter here:
RaananW/babylonjs-webpack-es6 (github.com)
If you want to use snowpack you can get started with:
npx create-snowpack-app new-dir --template snowpack-babylon-typescript
3 Likes
Thank you very much for your enthusiasm reply, I tried to delete two packs with @, I got the problem, I also tried to restart Visual Studio Code, and then I found that GUI was found, it is a strange thing.
2 Likes