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 import and module loading #5

Open
sumigoma opened this issue Apr 7, 2017 · 1 comment
Open

Dynamic import and module loading #5

sumigoma opened this issue Apr 7, 2017 · 1 comment

Comments

@sumigoma
Copy link

sumigoma commented Apr 7, 2017

Currently @ngconf, but couldn't ask this question due to the large crowd. I heard you answer a similar question, and you mentioned that for a number of reasons (including security) there are no real plans for webpack to support dynamic importing of external modules. In our scenario, we need two separate projects that will get recompiled for production at two different cadences independently.

Is it possible to "trick" webpack in anyway by adding an empty module of the same name at a certain external url at compile time, and then at runtime populating said module with more things (like an ngfactory)? Or would you recommend just going a completely different route like systemJS at that point?

@TheLarkInn
Copy link
Owner

Personally, to ensure that you are getting yourself too deep in the weeds of hacky webpack practices, I'd personally recommend that you look into using SystemJS. (The webpack org (sokra, etc.) would probably do the same. The problem is that we have a statically created scope that makes it impossible to not only optimize, but to know what will actually be available (from an external module). I know there was at one time an experimental SystemJS webpack plugin, however I am not sure how well maintained it is at the moment.

Hopefully that helps!

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