Closed Chargeuk closed 3 years ago
hi @Chargeuk
I did notice that and have been meaning to fix, but I'm not entirely sure how to fix yet 😞 The underlying issue is that some imports have moved from 4.2 to 5.0. One solution is to fix the downstream to include the extra export for backwards compatibility, but I hope to find a solution outside of the dependent library.
babylonjs is a peer dependency. In order to support both 4.2 and 5.0 simultaneously I would need to do some kind of dynamic import and choose the one that is defined, but I am not aware of the syntax for that.
When I did a recent code change (https://github.com/brianzinn/react-babylonjs/commit/9e174fc09dc21c1348238995e7c2f8bf1c340e78) it was to support the 5.0 alpha for code generation.
You an always quickly edit the import to be @babylonjs/gui/3D/materials/fluentMaterial
, but that's not a viable solution. The other failed import is VertexBuffer in @babylonjs/core
that also changed folder name.
I noticed also that you have forked this repo. You can always update to 5.0.0@latest and then npm link in the meantime. Do you know a way to dynamically import from a library where an import could be in different locations?
Hi @brianzinn, Thanks for the info, I really appreciate how responsive you are.
What you say makes sense, I can't think of a way that you could support both v4.2 and v5.x versions of Babylonjs from within a single package either... The only thing that would make sense is to maintain 2 versions, which I realise would probably increase your workload too much.
I did fork your repository in order to try to add V5 support myself. Not sure how far I will get, but I thought I may as well give it a try :-) - I'll let you know if I get it to work. Thanks
To generate the code, you just need to run yarn generate-code
(and I think you need to remove type: "module"
in package.json). I think the 5.0 is a long ways from GA, but I was thinking also that a fork is the only way - especially with how I did github actions I can't manually maintain 2 NPM streams.
Thanks for the info - I managed to get everything working with babylon v5.0.0-alpha.24 and have proven it works with my current babylon-react project. 👍
glad you got it working... I still need to figure out what to do going forward. There are already too many good things in 5.0 😄
Hi - I was wondering if you have pans to support the upcoming V5 alpha version of babylonjs?
v5 I managed to get alpha 17 working a while ago, but the @babylonjs/gui had to stay at 4.2 otherwise the following error occurs:
Failed to compile.
./node_modules/react-babylonjs/dist/react-babylonjs.js Module not found: Can't resolve '@babylonjs/gui/3D/materials/fluentMaterial' in 'F:\Dev\babylon-js\babshow\code2\fe\client\node_modules\react-babylonjs\dist'
Any help you can give would be greatly appreciated. Thanks