-
Notifications
You must be signed in to change notification settings - Fork 862
Description
Problem Statement
Wildcard exports in the main entry file (but also in other files in nested folders) cause tests to need to load and parse almost every file in the distribution package, upfront. Making it impossible to require only what's necessary.
wildcard re-exports by definition will have to eagerly load modules (fs read + parse + execute), which ends up being ~every file that EUI ships in its distribution
In numbers:
To quantify how much CPU is used:
- 800ms of Kibana startup (about 5%) is time being spent requiring EUI
- In each test file that ends up using EUI (which are 100s if not 1000s), it adds about the same delay to running the tests
What the wildcard exports look like in the main entry file:
// es/index.js
export * from './components';
export * from './services';
export * from './utils';
export * from './themes';
export * from './global_styling';Proposed Solution
To remove all wildcard exports.
wildcard exports would have to be stripped everywhere
Possible ways to do it:
A) adding a compile step that will convert all wildcard exports and imports to named exports and imports, or
B) writing a Babel plugin that will rewrite imports from the entry file to their source files?
A third option would be to manually remove them, making every single export explicit.
Related: