Opening Inspector in a webpack build recently stopped working

Hi folks! I recently updated to 5.0.0-rc.11 and noticed that opening the Inspector is broken for my webpack-based project. It was working in either 5.0.0-beta.11 or maybe beta.4 (not sure when I tested it last).

It looks like the culprit is in _getGlobalInspector. When I run my project, window.INSPECTOR is the Inspector object and gets assigned to BJSINSPECTOR. But then elsewhere is code like: BJSINSPECTOR.Inspector.<something> and BJSINSPECTOR.Inspector is undefined.

I tried to trace back to where this broke, but I got lost tracking history at the commit where lots of files moved.

My temporary workaround is:

window.INSPECTOR.Inspector = window.INSPECTOR  

can you switch to rc13?

cc @RaananW

1 Like

That fixed it. Sorry, I thought I had checked for the most recent version before reporting.

1 Like

No worries, I prefer that outcome :wink:

1 Like

Edit: Tried 5.0.0 and this error doesn’t happen.

I am also getting a build error on 5.0.1:

ERROR in ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js 3:55-97
Module not found: Error: Can't resolve '@babylonjs/shared-ui-components' in '/home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/inspector/dist'
resolve '@babylonjs/shared-ui-components' in '/home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/inspector/dist'
  Parsed request is a module
  using description file: /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/inspector/package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/inspector/dist/node_modules doesn't exist or is not a directory
      /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/inspector/node_modules doesn't exist or is not a directory
      /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/node_modules doesn't exist or is not a directory
      /home/jacob/Storage/Projects/meeting-hall/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/jacob/Storage/Projects/meeting-hall/node_modules
        single file module
          using description file: /home/jacob/Storage/Projects/meeting-hall/package.json (relative path: ./node_modules/@babylonjs/shared-ui-components)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/shared-ui-components doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/shared-ui-components.tsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/shared-ui-components.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/shared-ui-components.js doesn't exist
        /home/jacob/Storage/Projects/meeting-hall/node_modules/@babylonjs/shared-ui-components doesn't exist
      /home/jacob/Storage/Projects/node_modules doesn't exist or is not a directory
      /home/jacob/Storage/node_modules doesn't exist or is not a directory
      /home/jacob/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory

This is an internal package being treated as external. Sorry about that. 5.0.2 will be released shortly with a fix.

Sorry again!

1 Like

It’s working in 5.0.2 :smile:

2 Likes