Hi I hope I don’t miss anything because I’m new to the framework.
I use webpack and imported Vector3 with default es6 syntax. import { Vector3 } from '@babylonjs/core';
The following line results in an error: const camera = new ArcRotateCamera('camera', -Math.PI / 2, Math.PI / 2.5, 3, new Vector3(0, 0, 0), scene);
main.js:2 Uncaught TypeError: Cannot set property ‘_isDirty’ of undefined
When I use BABYLON.Vector3 with * import the error disappears.
which defines the package as external, making it not load. The reason BABYLON worked is the second issue: you are loading the UMD version of the babylon-loaders package. Move it to the es6 version of the loaders:
EDIT - wait, something went wrong. will be right with you on this one
So - 2 more issues found
You are loading babylon from the CDN in yout html file, which loads babylon twice.
And, in your hemispheric light, you don’t use new before the Vector3.
I have already seen these. Maybe I’m general on the wrong path. My goal was to use ES6 Syntax but temporarily load the Babylon Library from CDN to speed up build times. This did work as far as I can tell for Objects like Scene and Engine, but failed for Vector3.
I’m currently not sure if the approach is general not possible or if I’m doing something wrong.
As said I don’t want to waste your time too much - so totally fine if you ignore it…
The reason the vector3 failed is the lack of “new” in your hemispheric light. It will compile much faster if you loaded the full path object, and of course you can use externals but then don’t include the package at all, as it is not needed. Maybe just for syntax correctness in your editor, but that’s a bit confusing