Babylonjs editor to reactjs

Hello guys i am trying to convert the work I’ve done in the editor to a reactjs project.
i copied all the assets and put them in the public folder with babylon.scene
i loaded the model everything was great.
i repeated the same thing with a new workspace in the editor but i am getting this error and can’t debug why.

1 Like

cc @julien-moreau

Did you try downgrading the version of BabylonJs ?

yes i did try but still the same issue

Hey @Mostafa_Salloum !

I’m pretty sure this related to tree shaking. Projects are using the @babylonjs/* ES6 modules. In the index.ts file, don’t hesitate to import all necessary modules you use in your scene following this Babylon.js ES6 support with Tree Shaking | Babylon.js Documentation

like

// Classes I use in my file
import { Scene } from "@babylonjs/core/scene";
import { Nullable } from "@babylonjs/core/types";
import { Engine } from "@babylonjs/core/Engines/engine";
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader";
import { EngineStore } from "@babylonjs/core/Engines/engineStore";
import { Observable, Observer } from "@babylonjs/core/Misc/observable";

// Modules to include to they are available in the final build
// especially when loading scenes to create components
import "@babylonjs/core/Loading/loadingScreen";
import "@babylonjs/core/Materials/multiMaterial";
import "@babylonjs/core/Cameras/universalCamera";
import "@babylonjs/core/Lights/directionalLight";
import "@babylonjs/core/Lights/pointLight";
import "@babylonjs/core/Materials/PBR/pbrMaterial";
import "@babylonjs/core/Materials/standardMaterial";
import "@babylonjs/core/Loading/Plugins/babylonFileLoader";
import "@babylonjs/core/Rendering/prePassRendererSceneComponent";
import "@babylonjs/core/Materials/PBR/pbrMetallicRoughnessMaterial";
import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader";
import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent";
import "@babylonjs/core/Particles/particleSystemComponent";
import "@babylonjs/core/Misc/observableCoroutine";
1 Like