Skip to content

@babylonjs/inspector and gui-editor packages install unnecessary dependencies / cause TS errors in certain project setups #13581

@wmurphyrd

Description

@wmurphyrd

Repro

  • Bug repro : npm install @babylonjs/inspector && npm ls @types/react
  • Expected result: └── (empty)
  • Current result:
└─┬ @babylonjs/inspector@5.44.0
  ├─┬ @babylonjs/gui-editor@5.27.0
  │ └── @types/react@18.0.21 deduped
  ├─┬ @types/react-dom@18.0.6
  │ └── @types/react@18.0.21 deduped
  └── @types/react@18.0.21

npm 8.19.3

Additional context

Installing react types creates big problems in projects using typescript and non-react frameworks like vue. See e.g. vuejs/language-tools#592

These package are distributed as a pre-built bundles with the main and module fields pointing to dist files, so there's no need to include build-time dependencies, but npm installs these because they are listed as peer dependencies:

"peerDependencies": {
"@babylonjs/core": "^5.22.0",
"@babylonjs/gui": "^5.22.0",
"@babylonjs/gui-editor": "^5.22.0",
"@babylonjs/loaders": "^5.22.0",
"@babylonjs/materials": "^5.22.0",
"@babylonjs/serializers": "^5.22.0",
"@types/react": ">=16.7.3",
"@types/react-dom": ">=16.0.9"
},

Moving both @types/react and @types/react-dom from peerDependencies to devDependencies in these two packages would resolve the issue

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions