Open TrueSunGaming opened 1 year ago
The reason why every file currently has to be imported on its own is because I wanted to make the engine highly tree-shakable. My thought process was that there would be parts of the engine that would go unused, so it would not need to be included. If everything was re-exported from an src/index.ts
, then the engine wouldn't be tree-shakable, increasing the final bundle size.
As we started using it, however, I realize that, 1, the size of the unused modules is very small, and 2, there aren't many unused modules. As such, this will be implemented.
For the game development club game, the ability for kinematicBody
vs. kinematicBody
collisions to alter the final velocities of both objects is required. Since this collision feature is required for the game to continue development, it takes priority over this import change.
TL;DR: This will be implemented after #2 is completed.
The problem
Currently, the
import
statements required to extend theGameState
class are the following:It would be convenient if you could just import those from one module:
How it could be fixed
This could be fixed by importing everything into
src/index.ts
, then exporting them.Now, everything can conveniently be imported from
"merlin-game-engine"
or"merlin-game-engine/dist"
:This change also allows for everything to be imported into a namespace: