Disable Meteor asset combine

#1

Hello, my web app has a file: https://domain.com/6a24ae452b2eb091f76ce79cfbfd40a83de44ace.js?meteor_js_resource=true which is 1.2mb
How to prevent Meteor from combining its assets into 1 .js (and .css) file?

#2

I’m sure there is a way to do this, but why would you want to?

If it’s just because the bundle is so large, there are a few options you should look at regardless of if it’s in more than one file.

You should start by identifying which parts of your bundle add the most size using bundle visualizer:

Once you’ve identified heavy or unnecessary dependencies you can replace them with lighter ones. This normally saves a large chunk of bundle size.

Then you can start splitting your app using dynamic imports:

Which allows you to split heavy parts of your app to only load when needed, reducing initial bundle size even further.

1 Like
#3

Thank you for a quick response, Fred.
I run a Rocket.Chat server and I assume they’ve already done everything they could to minimize the size of the bundle.

A 1.2mb file takes a lot of time to process and isn’t being loaded asynchronyously, which is why I want to have multiple smaller files.

#4

This doesn’t really make sense from a performance point of view.
You still need to download & process the same amount of data from the same server to the same client. So you would only be adding extra overhead.

AFAIK rocket.chat doesn’t use code splitting with the dynamic imports such as @coagmano suggests. Reducing the size of what is needed on first page load and then dynamically loading in more is really the better approach here.

1 Like
#5

Doesn’t it?
It’s faster to initialize and async download 10 smaller files than 1 big file. Do I miss something?

Thank you for your suggestion, Seba.

#6

While async scripts would download faster, the js still needs to load in a particular order to ensure dependencies are met. Which async tags currently don’t have the ability to do

1 Like
#7

This makes a whole lot of sense. I didn’t know that.

#8

Once we get native browser modules working though, it’ll be a different story :smiley:
Async preloading with the module graph executed only when everything is ready!