jpadvo
jpadvo

Reputation: 6625

Can Meteor 1.5 dynamic importing be done on multiple scripts simultaneously?

Meteor 1.5 was recently released, and it has... dynamic imports!

All the examples I see are for dynamically importing one file, and then running code for it. I'm curious if there is a way to dynamically import multiple files with one declaration?

Thanks. :)

Upvotes: 0

Views: 102

Answers (1)

ghybs
ghybs

Reputation: 53205

Depends on what you mean by "import multiple files"…

Whenever you request a dynamic import, Meteor will fetch the required module and all its dependencies which are not already available in the browser cache.

On the contrary of classic HTTP request, the downloading is not parallelized, but goes through the already available Websocket. So all modules go through a pipe / queue.

If your code depends on multiple modules, you could simply write a "parent" module.

Or you could also aggregate your dynamic imports with Promise.all, since they return Promises.

Upvotes: 1

Related Questions