I tried to upgrade from 9.0.0 to 9.5.0.
I have issues with imports.
If I import this:
import { WoodProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, FireProceduralTexture, BrickProceduralTexture, RoadProceduralTexture, CloudProceduralTexture } from 'babylonjs-procedural-textures';
I get this:
babylonjs.proceduralTextures.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'ShadersStore')
at eval (babylonjs.proceduralTextures.min.js:1:1030)
at eval (babylonjs.proceduralTextures.min.js:1:23)
at eval (babylonjs.proceduralTextures.min.js:1:112)
at ./node_modules/babylonjs-procedural-textures/babylonjs.proceduralTextures.min.js (main.js:787:1)
at __webpack_require__ (main.js:990:32)
at fn (main.js:1248:21)
at eval (introScene.js:7:87)
at ./js/mainObjects/levels/introScene.js (main.js:338:1)
at __webpack_require__ (main.js:990:32)
at fn (main.js:1248:21)
Another example. If I import this:
import * as GUI from 'babylonjs-gui';
I get this:
babylon.gui.min.js:1 Uncaught TypeError: e.Vector2 is not a constructor
at eval (babylon.gui.min.js:1:5394)
at eval (babylon.gui.min.js:1:23)
at eval (babylon.gui.min.js:1:112)
at ./node_modules/babylonjs-gui/babylon.gui.min.js (main.js:777:1)
at __webpack_require__ (main.js:980:32)
at fn (main.js:1238:21)
at eval (guiManager.js:7:71)
at ./js/mainObjects/guiManager.js (main.js:195:1)
at __webpack_require__ (main.js:980:32)
at fn (main.js:1238:21)
I checked some intermediate versions and here is my regression log.
9.0.0 - everything works fine.
9.1.0 - npm run dev refuse to compile. It just crashes while trying to be built.
9.2.1 - Libraries are still loading and seem to work, but I get error with MergeMeshes. subMeshes array has only 0th index. Example:
const mesh = BABYLON.Mesh.MergeMeshes([sphere, face, fin], true, false, false, false, true);
mesh.subMeshes[0].materialIndex = 0;
mesh.subMeshes[1].materialIndex = 1; //will crash here
mesh.subMeshes[2].materialIndex = 2;
mesh.material = multimat;
9.3.0 - Same as 9.2.1
9.4.0 - Same as 9.3.0.
9.5.0 - cannot import babylonjs dependencies anymore.
Full package.json for reference:
{
"name": "babylonfpskit",
"version": "0.0.1",
"description": "Babylon FPS Kit",
"main": "js/app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --config webpack.dev.js",
"build": "webpack --config webpack.prod.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"clean-webpack-plugin": "4.0.0",
"copy-webpack-plugin": "14.0.0",
"html-webpack-plugin": "5.6.6",
"terser-webpack-plugin": "5.3.17",
"webpack": "5.105.4",
"webpack-cli": "6.0.1",
"webpack-dev-server": "5.2.3"
},
"dependencies": {
"@babylonjs/havok": "1.3.12",
"@babylonjs/inspector": "9.5.0",
"babylonjs": "9.5.0",
"babylonjs-gui": "9.5.0",
"babylonjs-loaders": "9.5.0",
"babylonjs-materials": "9.5.0",
"babylonjs-post-process": "9.5.0",
"babylonjs-procedural-textures": "9.5.0",
"babylonjs-serializers": "9.5.0"
}
}
Notes on using â@â imports. I read that using â@â imports is encouraged and I gave it a fair shot, but I canât prefer them because:
a) I use a lot of BabylonJS features, so there is little to no dependency shaking can be done, thus, I still receive a pretty big bundle on the start, which apparently is about 1MB bigger, compared to old approach, so I will actually lose from transition to â@â.
b) I still need to import additional stuff for side effects.
c) WIth old approach I can just do import * as BABYLON from "babylonjs"; and all my BabylonJS related stuff will be nicely hidden inside of BABYLON namespace, so everything BabylonJS is being called like BABYLON.<babylon_feature>. WIth â@â approach it would require me to do an extra step to achieve the same.
But anyway, I didnât find any mentions in the changelog that say that you are killing the old âbabylonjs-*â dependencies. So, I assume, things just got broken.