datitisev Thanks for putting a thought on this. You are right, there is a lot of complexity. It definitely requires a lot of thinking if at all to be implemented. I had put a thought on this once, one way this could be done is accept additional parameter to whether compact specifed js or just copy to output folder.
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/Home.js', copyToOutputFolder : true)
and extensions may use mithril route onmatch loading
m.route(document.body, "/", {
"/": {
onmatch: function() {
return load("Home.js")
}, },})
But when extensions start using this, they may have to use unique names for these js files so that names do not clash between extensions. One solution is to force extension name prefixing to file names ...
Again, just a vague thought. Surely there is a lot of complexity that will go in. I have not even considered webpack here. But in long run, code splitting may be way to go.