# Import "@babylonjs/inspector" 'breaks' VSCode debugging

**URL:** <https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401>\
**Category:** Questions\
**Tags:** inspector\
**Created:** [May 16, 2022, 12:31am UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401 "2022-05-16T00:31:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayKoopa](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RayKoopa](https://forum.babylonjs.com/u/RayKoopa)\
**Post date:** [May 16, 2022, 12:31am UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/1 "2022-05-16T00:31:20Z")

</div>

Hello everyone,

I use a clean setup using VSCode, NPM, and Webpack. As soon as I `import "@babylonjs/inspector"`, debugging kinda breaks:

- Stepping through the code becomes thrice as slow (takes ~2 seconds each step for me).
- Hovering variables never shows their value anymore.

Is the inspector so heavy that the debugger gives up on some functionality?

**I’d love to know if you have the same issue** and if I can somehow solve this.

- I uploaded a sample repo [on GitHub](https://github.com/RayKoopa/babylonjs-inspector-debugging)
- The breaking change is in line 3 of `index.ts` - uncomment the inspector import (which seems required or it will throw trying to open it) and debugging goes awry as stated above.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 16, 2022, 1:30pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/2 "2022-05-16T13:30:31Z")

</div>

cc @RaananW

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 16, 2022, 1:42pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/3 "2022-05-16T13:42:31Z")

</div>

> [@RayKoopa](#):
>
> Is the inspector so heavy that the debugger gives up on some functionality?

The inspector is not so heavy, as much as it also includes many other packages (like gui, serializers, loaders and so on), that it might take a little while for your debugger to catch up. Is it working in chrome but fails in vscode, or is chrome not working as well?

---

<div class="post-metadata">

**Author:** ![RayKoopa](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RayKoopa](https://forum.babylonjs.com/u/RayKoopa)\
**Post date:** [May 16, 2022, 2:28pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/4 "2022-05-16T14:28:46Z")

</div>

Thanks for replying. I did some more testing with these results; it seems only the bolded issue below remains:

- Stepthrough speed is only slow during scene setup code, and ~instant in code called by the main loop. Behaves the same in Edge-Chromium or VSCode. (It is additionally slower in the setup code if the inspector is included, but while that’s slightly annoying, it’s the main loop debugging that matters more to me).

- Variable hovers always work in Edge-Chromium (albeit with a short delay). **But in VSCode they break everywhere once the inspector is included** (even in code called by the main loop which steps through performantly).

I wonder if I should throw my repo at the VSCode devs so they can check why this happens. Unless you have an idea what else I could check / do here. Also wonder if I’m the only one with this issue despite using clean setups for this; unless I misconfigured something in webpack or so… my PC also shouldn’t be too slow with an i7-6700K… 🤔

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 16, 2022, 2:40pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/5 "2022-05-16T14:40:29Z")

</div>

TBH I haven’t tested it in a while. Want to share your project with us? I can do that same and see if I get the same results

---

<div class="post-metadata">

**Author:** ![RayKoopa](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RayKoopa](https://forum.babylonjs.com/u/RayKoopa)\
**Post date:** [May 16, 2022, 2:48pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/6 "2022-05-16T14:48:10Z")

</div>

Sure! I posted a link to a sample repo above: [GitHub - RayKoopa/babylonjs-inspector-debugging: Demonstrates debugging issues with VSCode once the babylonjs inspector is imported.](https://github.com/RayKoopa/babylonjs-inspector-debugging)  
The variable hovers break in VSCode if you keep the inspector import in index.js, and work if you comment it out.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 16, 2022, 3:57pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/7 "2022-05-16T15:57:21Z")

</div>

Assigned @RaananW on May 16, 2022, 3:57pm UTC



---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 17, 2022, 9:34am UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/8 "2022-05-17T09:34:16Z")

</div>

So! If i can suggest a solution - use `devtool: "eval-cheap-source-map"` instead of inline source maps when debugging. Then vscode works correctly:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/a/fa5f33337b95ea4da26d358a1a5377875c26098f.png)

I believe the file sizes with inline source maps are just really big and drive vscode a bit crazy… But this is not an official explanation, of course 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 17, 2022, 9:34am UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/9 "2022-05-17T09:34:21Z")

</div>

Unassigned @RaananW on May 17, 2022, 9:34am UTC



---

<div class="post-metadata">

**Author:** ![RayKoopa](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RayKoopa](https://forum.babylonjs.com/u/RayKoopa)\
**Post date:** [May 17, 2022, 4:02pm UTC](https://forum.babylonjs.com/t/import-babylonjs-inspector-breaks-vscode-debugging/30401/10 "2022-05-17T16:02:01Z")

</div>

Thanks so much! That helps indeed! I noticed some breakpoint lines don’t match up with what’s actually being executed during setup with these source maps, but once in the main loop, they seem fine.

I guess I’ll remember that in case I run into it another time, though if someone else finds this topic… please reply, because then it feels like it should be reported to the VSCode team (since it works in Edge-Chromium)…
