After I was able to get a custom version built with Brian’s rollup version, I was able to get the webpack version working with the following files.
my custom.ts file that I place in the Babylon.js/tests/es6Modules folder
import "@babylonjs/core/Meshes/meshBuilder";
import "@babylonjs/core/Loading/Plugins/babylonFileLoader";
import '@babylonjs/core/Meshes/thinInstanceMesh';
// export { Engine, Scene, FreeCamera, MeshBuilder, HemisphericLight, Vector3 } from '@babylonjs/core';
export { Scene } from '@babylonjs/core/scene';
export { Engine } from '@babylonjs/core/Engines';
export { FreeCamera } from '@babylonjs/core/Cameras';
export {MeshBuilder} from '@babylonjs/core/Meshes/meshBuilder';
export {Mesh} from '@babylonjs/core/Meshes/mesh';
export {SubMesh} from '@babylonjs/core/Meshes/subMesh';
export {TransformNode} from '@babylonjs/core/Meshes/transformNode';
export {VertexBuffer} from '@babylonjs/core/Meshes/buffer';
export {InstancedMesh} from '@babylonjs/core/Meshes/instancedMesh';
export {GroundMesh} from '@babylonjs/core/Meshes/groundMesh';
export { HemisphericLight} from '@babylonjs/core/Lights/hemisphericLight'
export { DirectionalLight} from '@babylonjs/core/Lights/directionalLight'
export { Color3, Color4 } from '@babylonjs/core/Maths/math';
export { Quaternion, Matrix, Vector2, Vector3, Vector4 } from '@babylonjs/core/Maths/math.vector';
export { Axis, Space } from '@babylonjs/core/Maths/math.axis';
export { SceneLoader } from "@babylonjs/core/Loading/sceneLoader";
export { Texture } from '@babylonjs/core/Materials/Textures/texture';
export { Skeleton } from '@babylonjs/core/bones/skeleton';
export { Bone } from '@babylonjs/core/bones/bone';
export { BoneIKController } from '@babylonjs/core/bones/boneIKController';
export { AssetsManager } from '@babylonjs/core/misc/assetsManager';
export { Observable } from '@babylonjs/core/misc/observable';
export { PointerEventTypes } from '@babylonjs/core/events/pointerEvents';
export { StandardMaterial } from '@babylonjs/core/materials/standardMaterial';
export { MultiMaterial } from '@babylonjs/core/materials/multiMaterial';
export {FresnelParameters} from '@babylonjs/core/materials/fresnelParameters';
export {SolidParticleSystem} from '@babylonjs/core/particles/solidParticleSystem';
export {BoundingInfo} from '@babylonjs/core/culling/boundingInfo';
export {Tools} from '@babylonjs/core/misc/tools';
export { Animation } from "@babylonjs/core/Animations/animation";
export { CustomProceduralTexture } from '@babylonjs/core/materials/textures/procedurals/customProceduralTexture';
export { PickingInfo } from '@babylonjs/core/collisions/pickingInfo';
export { CustomMaterial } from '@babylonjs/materials/custom/customMaterial';
and the webpack.config.js file (basically just deleted tests from entry section added library:“BABYLON” to the output section)
const path = require("path");
const config = require("../../Tools/Config/config");
module.exports = {
context: path.resolve(__dirname),
entry: {
custom: path.resolve(__dirname, 'custom.ts')
},
output: {
library: "BABYLON",
filename: '[name].js',
path: config.computed.tempFolder + '/testsES6Modules'
},
devtool: 'none',
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [{
test: /\.tsx?$/,
loader: 'ts-loader'
}]
},
mode: "production"
};
in the Babylon.js/tests/es6Modules folder run:
npx webpack
when that is finished there should be custom.js file in Babylon.js/.temp/testsES6Modules folder.
This custom.js file is 1920KB compared to the babylon.js + babylon.customMaterial.js file I was using which is 3306KB + 49KB. The custom.js file that I created with rollup is 2056KB after running it through uglifyjs with just the --compress option.