Open
Description
Suggestion
π Search Terms
- secondary auto import
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
When auto importing it would be nice if the importer prefered secondary
entry points instead of main entry point, as it gets tiresome having to modify or manually write the imports to use a secondary entry point.
Note: It does use the secondary entrypoint if it has already been defined in the file. However, this is for on initial import.
π Motivating Example
This allows compilers (such as webpack) to tree-shaking. If including the main entry point all modules get included in the build (for libraries that have them all exported in the main entry point) whereas importing secondary entry points only includes (usually) parts of the library.
π» Use Cases
Workaround: Manually updating every import every time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment