Hi there!
It’s been quite a long time and still there’s no satisfactory answer to the following question:
How to split a meteor application into chunks and deliver them to the client on demand?
It could be quite useful to optimize the application loading time in scenarios when you want to serve a slightly different subset of your source code depending on the user’s role.
Current situation
Looking at the Meteor roadmap here:
it seems there’s been a lot of experiments around this subject, most of them focusing on the area of a source code delivery mechanism. Though, we all know that the real problem here is not in the code delivery, but in some obstructions in the project Meteor build mechanism. Namely, there’s currently no way to tell the “bundler” to split your client source code into several chunks, and there’s also no way to ignore certain files during the build process.
We’ve been hearing a lot answers of it-is-by-design type, and I am pretty much sure I can understand the reasoning behind that. I also believe that there are a lot of developers who knows well what they’re doing and they could use this “chunks feature” in a good way.
Some time ago, I’ve done my own research in the topic:
but it was while the big changes were happening to the Meteor packaging system so it was not realistic to encourage MDG to accept any additional development in that area.
Possible solution?
I think that we are currently in a situation when we can at least discuss some possible solutions to the problem I described above.
One idea I’ve been thinking about was to have a file, e.g.
.meteor/chunks
, .meteor/client_bundles
or just .meteor/bundles
describing which files should be included with particular chunks during the build process
[default]
include client/**/*
exclude client/dashboard/**/*
[dashboard]
include client/dashboard/**/*
Then in the __meteor_runtime_config__
we may have a dictionary mapping a chunk name to a list of corresponding “bundled” files. From know on, it only depends on the developer how those files are loaded. Of course the default
bundle should be included in <head>
tag the same way it’s done right now.
Question
Please let me know what do you guys think about this and if it’s realistic to finally get this feature implemented. I can always try to take responsibility for the “hard work” but I don’t really want to waste time if the other developers and MDG thinks it’s a bad idea. So I am waiting for your feedback guys.