meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Dynamic importing dynamic versions #351

Open arggh opened 5 years ago

arggh commented 5 years ago

(I couldn't resist writing that title.)

TL;DR Using dynamic imports can quickly increase the size of dynamic-versions.js, which is loaded in the static bundle. Could we somehow make it smaller or loaded dynamically?


I've been refactoring a rather large app to benefit from dynamic imports. I started with about 5Mb payload of JS without dynamic imports. Cutting away most of the app except login, signup and few necessities got me to around 985kb. From there on, I started to include routes and components via dynamic imports.

Soon I noticed that the dynamic-versions.js file, which gets shipped with the static bundle, was slowly but surely growing and growing. It's now almost 200kb.

When aiming for < 500kb initial payload, especially with a Meteor app, that 200kb is a lot!

I wonder if there is a way to reduce the size of that file?

mariusrak commented 4 years ago

I have no dynamic-versions.js file in my bundle. However I have a file app.js which includes all files that are available in the application even those that were not requested yes. You mean this file?

If so, I agree with You, that it would be great if it was not needed to send whole tree to user but rather load it as further parts are fetched.

mitar commented 4 years ago

Is 200kb even when compressed?