Cannot build with @babylon/inspector#4.1.0 (Unterminated regular expression)

Hi,

I have encountered a problem with Babylon Inspector (4.1.0). Here is a test project to demonstrate this issue: GitHub - AntonKosov/babylon-inspector-bug

When I import Inspector (src/index.ts):

import “@babylonjs/core/Debug/debugLayer”;
import “@babylonjs/inspector”;

and try to run “npm run live:bug”, I get the following error:

×  C:\dev\git\babylon-inspector-bug\node_modules\@babylonjs\inspector\babylon.inspector.bundle.max.js:39307:83: Unterminated regular expression (39307:83)
  39305 |       if (sourceMap) {
  39306 |               // http://stackoverflow.com/a/26603875
> 39307 |               css += "\n + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
    |                                                                                               ^
  39308 |       }
  39309 | 
  39310 |       var blob = new Blob([css], { type: "text/css" });

It seems to me that there is no quotes after “\n”.
Could anybody help me with the inspector?

If I get the babylon.inspector.bundle.max.js file from the github directory (Babylon.js/dist/inspector at master · BabylonJS/Babylon.js · GitHub), your error is not at line 39307 but at 40056 and the line reads:

css += "\n/*# sourceMappingURL=data:application/json;base64," + 
    btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";

So it seems you miss a part of the string.

It seems your file has been processed in some way, as the line numbers don’t match (try to check manually the file C:\dev\git\babylon-inspector-bug\node_modules@babylonjs\inspector\babylon.inspector.bundle.max.js)…

Thank you.

You are right, I’ve found the culprit. It’s parcel. Here is the bug.