Remove use of RegisterClass
Ok folks! another new monster :)
I removed the need for side-effects for a LOT OF classes by replacing RegisterClass with the use of require.context
@ryantrem: please make sure that it is not a problem for the Viewer @RaananW: I did not do the change for the FlowGraph because for some reasons that I do not know you are using FGxxx in the key for RegisterClass
The main class: https://github.com/BabylonJS/Babylon.js/pull/15671/files#diff-6a2ff5432bcbb1632f27a94f714a7a50f7b3c4cac5d35bd7b7f8570746752e12
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
require.context is not ecma standard, and is webpack specific. adding this will make our package not work in browser anymore. Let's find a better way instead of that.
The idea of require.context is to be a synchronous import, but this is bundler specific (webpack in this case).
@RaananW: I did not do the change for the FlowGraph because for some reasons that I do not know you are using FGxxx in the key for RegisterClass
This will be changed as part of the changes I am making. there was a thought to shorten the names of the classes to save a few bytes, but this is not the right place to minimize input :-)
Hey this is basically my question. Rollup and parcel have no equivalent so if we want to be side effects free what are our options regarding RegisterClass within the framework?
typeStore (e.g. RegisterClass, GetClass) is not considered a public API, it is internal only, correct? If the goal is to be able to tree shake out unused stuff, then it seems like we just need to replace this mechanism with well defined imports, right? I don't know the history though of typeStore and why we even have this functionality to register and retrieve types by names...
It is internal to allow us to parse from serialized data (as the class will store its type so we can rebuild it at parse time). The question is then: how do you replace the feature?
This pull request has been marked as stale because it has been inactive for more than 14 days. Please update to "unstale".