Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Imports Support with Advanced Optimizations #93

Open
kristoferbaxter opened this issue Oct 18, 2018 · 2 comments
Open

Dynamic Imports Support with Advanced Optimizations #93

kristoferbaxter opened this issue Oct 18, 2018 · 2 comments
Assignees

Comments

@kristoferbaxter
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Add official support for dynamic import with advanced optimizations.

Describe the solution you'd like

The issue preventing support currently is modules requesting a dynamic import cannot know the structure of public items in the requested module. As a result Closure Compiler will mangle references differently than in the bundle returned from dynamic import.

If the plugin could determine the shape of exported members from dynamic imports it could create an extern automatically for the importer to prevent mangling of public items.

@kristoferbaxter kristoferbaxter self-assigned this Oct 18, 2018
@kristoferbaxter
Copy link
Contributor Author

kristoferbaxter commented Jan 16, 2019

Working POC landing in a branch in a few minutes. (See branch advanced-code-splitting).

When a dynamic import is discovered.

  1. Analyze the exports of the dynamic import.
  2. Create an extern definition of the exports, and if they are functions their shape.
    { 'name': function(arg1, arg2, ...), 'another': number, ... }
  3. Attach this extern definition importer of the dynamic import. (per dynamic import)
  4. When creating the extern for each file containing a dynamic import, include the discovered extern.

@filipesilva
Copy link

Heya, did you end up adding support for this?

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

No branches or pull requests

2 participants