Hey there,
im trying to treeshake babylonjs but it looks like the bundle is still really big with a size of 5.59 MB. Its a Vue3 + Vite Application and Babylonjs is responsible for 91% (5.13MB) of the bundlesize. Is this normal or is the treeshaking not working for me?
Here is a list of all the babylon imports im doing in my project.
import { Engine } from "@babylonjs/core/Engines/engine";
import { Scene } from "@babylonjs/core/scene";
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera";
import { DefaultRenderingPipeline } from '@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/index';
import { AssetsManager } from '@babylonjs/core/Misc/assetsManager';
import { Vector3, Color3 } from "@babylonjs/core/Maths/math";
import { Animation } from "@babylonjs/core/Animations/animation";
import { TransformNode } from "@babylonjs/core/Meshes/transformNode";
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
import { Texture } from "@babylonjs/core/Materials/Textures/texture"
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial'
import { ActionManager } from "@babylonjs/core/Actions/actionManager";
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions';
import { CubicEase, EasingFunction } from "@babylonjs/core/Animations/easing";
import { Mesh } from '@babylonjs/core/Meshes/mesh';
import "@babylonjs/loaders/glTF";
import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader";
A visualisation of the bundle.In the bundle is also Babylonjs Audio or Bones which I never use…
I am using Vite to build my application. Here are the vite configurations, nothing special I think:
import path from "path";
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
base: "./",
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
}
},
server: {
open: "index.html",
host: true
}
})