Skip to content
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

minecraft-protocol increases node_modules size by more than 200% #978

Closed
jojomatik opened this issue Apr 9, 2022 · 5 comments
Closed

minecraft-protocol increases node_modules size by more than 200% #978

jojomatik opened this issue Apr 9, 2022 · 5 comments

Comments

@jojomatik
Copy link
Contributor

[x] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: 1.30.0
  • server: vanilla/spigot/paper n.a.
  • node: 16

Detailed description of a problem

The library includes a lot of dependencies, it increased the size of /node_modules by more than 200% and my docker image by about 50%. I believe this might be a bug (e.g. dev-dependencies included as prod-dependencies).

See also jojomatik/blockcluster#390. I've taken a look at the compressed sizes on dockerhub and have narrowed the range of commits down to the addition of this library to my project (even though the difference on dockerhub is pretty small in the compressed sizes).

Would you be able to take a look at all dependencies? Which ones are strictly necessary? Which dependencies would suffice as dev-dependencies? Would it be possible to make some dependencies optional, based on the protocol used?

Current code

n.a.

Expected behavior

/node_modules and docker image don't increase dramatically.

Additional context

Before:
image

image

After:
image

image

@rom1504
Copy link
Member

rom1504 commented Apr 9, 2022

We have a single dependency that uses space: minecraft data. It uses 70MB when uncompressed, 4MB when compressed

What problem are you trying to solve?

@jojomatik
Copy link
Contributor Author

I only use a very small portion of this library: I create a mock server that listens for a connection and starts the "real" minecraft server as soon as a client tries to connect.

If minecraft-data really uses that much space, that is really unfortunate for my use-case, as I'd believe that I only use a very small part of that data. Would there be a possibility to only include the relevant parts?

I've tried to decrease the docker image size in the past to fasten download times especially for automatic re-deployment to minimize the downtime. Adding this much data is really unfortunate in that case.

@rom1504
Copy link
Member

rom1504 commented Apr 9, 2022

docker images are compressed by default, so this shouldn't cause you any issue

@jojomatik
Copy link
Contributor Author

Yeah, that seems to be true for download times.

They seem to get uncompressed as soon as they are downloaded, but that shouldn't be too much of an issue then the more I think about i. If I remove all unused/ old images and never have to run a lot of different versions of my software at the same time, those 70MB should not cause any issues.

Thanks for the fast response and clarification :)

@rom1504
Copy link
Member

rom1504 commented Apr 9, 2022

yeah, you're not the first one to point this out though
we could consider keeping the files as compressed in the npm package and only uncompressing at run time
PrismarineJS/node-minecraft-data#185 here's an issue to track that idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants