-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@babylonjs/inspector and gui-editor packages install unnecessary dependencies / cause TS errors in certain project setups #13581
Comments
The inspector typings depend on react, so those typings are needed in order to use the inspector as is. Building with the inspector will fail on (ts-enabled) projects that don't include those. npm has changed the way it treats peer dependencies (personally I find it better, but one could argue that it isn't ;-) ). So the dependency is installed. |
@RaananW types don't exist at runtime in javascript, so having type libraries as a runtime dependency is never useful I'll leave this here for others that have the issue then since this is closed: the workaround described here for stubbing out the unnecessary react types library does work: vuejs/language-tools#592 (comment) |
You will notice i did mention typescript in my answer. And the same goes to what you said - it shouldn't fail 🙃 |
I did some research regarding what can be done here. I believe the es6 version could be exported without the react dependencies, if we change the public API available for the package consumer. However, I prefer not to make this change a week before our 7.0 release. |
This issue has been automatically staled because it has been inactive for more than 14 days. Please update to "unstale". |
Repro
npm install @babylonjs/inspector && npm ls @types/react
└── (empty)
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:
Babylon.js/packages/public/@babylonjs/inspector/package.json
Lines 24 to 33 in d521fd0
Moving both
@types/react
and@types/react-dom
from peerDependencies to devDependencies in these two packages would resolve the issueThe text was updated successfully, but these errors were encountered: