Hi there, I was just wondering if anyone else has been running into this issue with Babylon.js recently.
We are using Babylon.js 5.57 (also tested with 6.14) on our project, and are using Rollup to bundle our files. We are using deep imports from babylon extensively, i.e.
import { PBRMaterial } from ‘@babylonjs/core/Materials/PBR/pbrMaterial’;
import { BaseTexture } from ‘@babylonjs/core/Materials/Textures/baseTexture’;
import { Texture } from ‘@babylonjs/core/Materials/Textures/texture’;
import { Material } from ‘@babylonjs/core/Materials/material’;
import { MultiMaterial } from ‘@babylonjs/core/Materials/multiMaterial’;
import { VertexData } from ‘@babylonjs/core/Meshes/mesh.vertexData’;
…
in order to save on bundle size.
It appears that sourcemaps don’t line up correctly anymore when bundling our application, when including the es6 Babylon modules. On Babylon.js 5.21.0, everything works as expected, on 5.22.0, I get “Bad Token” build errors and the whole project fails to build. On 5.27.1, the build completes successfully once again, but anything onwards from that version has source maps that are completely shifted from the real code. When you put breakpoints, they don’t get hit because the “real” breakpoint is on a completely different line. This can be seen when you disable the sourcemaps in chrome and the breakpoints move to unrelated places in the code. Debugging works fine with sourcemaps disabled.
I thought it was a rollup issue so converted our whole project to the latest version of Vite and am still seeing the same behavior with the sourcemaps. It’s evidently being caused by Babylon because when I change the version back to 5.21 the souremaps work perfectly again.
Has anyone else noticed this issue?