Import directory

Hi there,

is the import and export feature really a must when It comes to performance? It makes a lot things more complicated!

I have an app once created with meteor 1.2, and to upgrade that into the new app structure Is a very hard work to do.

Any recommendations?

Import/export has a bunch of benefits, mostly around code splitting and dynamic imports. For us, the benefit has mostly been around a guaranteeing load order based on dependencies.

Whether those benefits actually translate into a performance benefit for you is something you’ll need to decide for your own context.

For splitting and dynamic imports, I’m pretty sure they will work with eager loaded modules as well, so you can have the best of both worlds.

eg. You load a heavy charting library on a reports page, but not elsewhere. Use dynamic imports only for that reports package when it’s needed but keep the existing eager loading file structure for the rest of your app

Also you can use tools like import-js to automatically build import directives:

You will have to export your globally defined modules/objects/functions/etc manually before that will work though