-
Notifications
You must be signed in to change notification settings - Fork 12k
Generate import maps #26316
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
Comments
Support for imports map are something that we are looking at as part of #17556 One way to achieve this to, would be to mark these packages as external using the |
+1 to However externalizing Since import maps are possible to do manually and micro-frontends are tracked separately, I'll close this as a dupe since there's nothing actionable here specifically. Duplicate of #17556 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build, serve
Description
Our application has a plugin system where it needs to load external modules that are not known at build-time. These external modules are often (but not always) Angular components, and they share dependencies with the application. Think:
The above does not work, since there is no way for
plugin.js
to resolve the"@angular/core"
import.We have solved this by making sure the plugins are SystemJS modules rather than ES Modules, and they are imported with
System.import()
with some custom resolvers (see below).However, we would really like to drop SystemJS and use ES modules instead. But this is not possible today.
Describe the solution you'd like
In order to load external modules that depend on bare specifiers, I think the cleanest solution would be to use Import Maps. A possible solution would be for Angular CLI to generate import maps for some chosen dependencies. Like:
angular.json
index.html
Alternatively, there could be a way to write & use plugins for esbuild (or vite?) that does this, if it is possible to get the generated chunk name in there.
Describe alternatives you've considered
We are currently forcing the plugins to be built as SystemJS modules, and they are imported with
System.import
. Like:The text was updated successfully, but these errors were encountered: