Sign in to follow this  

tried new @babylonjs/core, but it doesn't tree shaking?

Recommended Posts

I tried @babylonjs/core 4.0.0

import {
} from '@babylonjs/core'


It doesn't seem to do proper tree shaking as the build bundle still includes everything(tried webpack-bundle-analyzer), and the size is still 2.11m.

Share this post

Link to post
Share on other sites

The forum as moved here : you should post there for any questions.

Regarding yours, the side effects not being filled in the package.json (currently under dev) you need to import from individual modules:

import { Engine } from "@babylonjs/core/Engines/engine";
import { Scene } from "@babylonjs/core/scene";
import { Vector3 } from "@babylonjs/core/Maths/math";
import { FreeCamera } from "@babylonjs/core/Cameras/freeCamera";
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
// Side effect import to fill in the default material on scene and Mesh.CreateBox functions
import "@babylonjs/core/Materials/standardMaterial";
import "@babylonjs/core/Meshes/Builders/boxBuilder";
This is all detailed in the package doc:


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.