I am sorry, but looking at cut out sources will not be helpful for me. It is very much possible it is happening because of the module resolution, or because of the bundler configuration, or because different reasons. What I can tell you is this - usually there is no need to use this package directly. If you do want, it should work, as it works in any other project importing it (including our loaders). Something in your project setup tries to actively import something from this package, and this is wrong.
these are const enums. typescript embeds them in your code and removes the import. Try playing around with the tsconfig or your bundler configuration to check why typescript doesn’t do that
As I see in this screenshot, you mix 2 different Babylon npm packages - with @ (ES6) and without @.
I’ve heard from friends that it is much better to use only one npm package
Agreed with others, that there is generally no reason to use these types directly. So it’s unclear what you are trying to do. However, if you have some legit reason for trying to use these types, perhaps something like this helps you:
import type { IGLTFAnimationChannelTarget } from '@babylonjs/loaders/glTF/1.0'
Generally speaking, GLTFFileLoader is sufficient, but now we have unique requirements and need to make some modifications based on gltf. Therefore, we plan to make modifications on glTFLoader.ts. My current approach is to copy a copy of @babylonjs/loaders/glTF/2.0/glTFLoader.ts
for modification. In glTFLoader. ts, there is a type for importing babylonjs-gltf2interface. The Vite scaffold I used encountered an error when I introduced const enum.
import type { IProperty } from "babylonjs-gltf2interface";
import {
AnimationChannelTargetPath,
AnimationSamplerInterpolation,
AccessorType,
CameraType,
AccessorComponentType,
MaterialAlphaMode,
TextureMinFilter,
TextureWrapMode,
TextureMagFilter,
MeshPrimitiveMode,
} from "babylonjs-gltf2interface";
Yes, I have tried it. But it will prompt that there is an error in the type, and comparing it like this seems unintentional, because the types “BABYLON.GLTF2. AccessorElementType” and babylon.glTF2Interface AccessorWidgetType "does not overlap
hi, I think I have already solved it. My project uses Vite, and I need to configure a real . ts file for babylonjs-gltf2interface. Then I will copy the packages/tools/devHost/src/babylon.glTF2Interface. ts
from the internet to my local device for use.