node-minecraft-data icon indicating copy to clipboard operation
node-minecraft-data copied to clipboard

Reduce unnecessary package size

Open Owen3H opened this issue 1 year ago • 6 comments

Currently, consuming the library pollutes node_modules with over 100MB of data that most of the time is never actually used. A simple way to largely reduce this would be splitting the platforms like so:

minecraft-data@pc (Independent) minecraft-data@bedrock (Independent) minecraft-data (Depends on both)

Owen3H avatar Jun 24 '23 13:06 Owen3H

Curious what you mean by "bundle" specifically.

When compressed, all this data is about 2MB

rom1504 avatar Jun 24 '23 14:06 rom1504

Why is unpacked size important?

rom1504 avatar Jun 24 '23 14:06 rom1504

This also isn't going to work, having 3 packages can have the opposite effect doubling the package size. For example, what happens when a package depends on minecraft-data and then another package on minecraft-data@pc? You get 1.5x right there in the dep tree. Not to mention having to change all the require statements.

extremeheat avatar Jun 24 '23 15:06 extremeheat

Link to discord discussion https://discord.com/channels/413438066984747026/743199746876768318/1127735522626904074 - some proposals about compression and using alternative packages discussed

extremeheat avatar Jul 10 '23 22:07 extremeheat

Rom suggested using a separate async package, I commented

I commented on an issue but to do that you’d also need to make sure all the subdeps are using the same package also otherwise it will use more disk space in the end. Including rewriting the requires() statement

Also for async that would probably be a breaking API change as most mcdata assumes static access (would require awaiting before you access any data)

extremeheat avatar Jul 10 '23 22:07 extremeheat

related #185

rom1504 avatar Jul 10 '23 22:07 rom1504