Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Refactor Exports #115

Closed
lukeed opened this issue Feb 6, 2018 · 2 comments · Fixed by #118
Closed

Refactor Exports #115

lukeed opened this issue Feb 6, 2018 · 2 comments · Fixed by #118

Comments

@lukeed
Copy link
Member

lukeed commented Feb 6, 2018

Piping all exports to/from core/index.ts results in all of core being used everywhere.

As with #114, because of the scope/import-hoisting, all files' immediate prep work is called instantly, regardless of what the CLI or runtime actually wants.

In practice, this means that something like core/export.ts is always initiated & running, even during production-mode as a middleware!!!

AKA, something as big/heavy as Express is always running, even if you don't want it!

screen shot 2018-02-05 at 4 17 43 pm

As much as I love Rollup (seriously, it's the best!), I don't believe it should be used in compiling Node.js CLIs and runtimes. I see this issue happen a lot and often.

Opinions aside, this can be solved by removing the core/index.ts aggregator in favor of direct imports — we are using Rollup, so why not? We should also be moving most/all of the prep-work inside the actual export. This will prevent things from being called & prepped until we actually want them to.

I don't have time to do this today, sorry! But happy to tackle it, if no one else has, once my schedule opens up~!

@Rich-Harris
Copy link
Member

Gah, whoops. Good catch, thanks. Aside from TypeScript, one of the reasons I moved towards bundling was for marginally faster startup times, so it's ironic if I inadvertently made things slower.

@lukeed
Copy link
Member Author

lukeed commented Feb 6, 2018

Haha, yeah, it happens! Export all the things™

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants