Multiple Importmaps#279
Conversation
If needed multiple importmaps can be defined in the `config/importmaps` directory. `bin/importmap` have a new option to work with named importmaps `bin/importmap -i admin pin "some-dependency"` The default is still `config/importmap.rb` so no change for exisiting users that does not need multiple importmaps or complexity.
|
@dhh would you consider this implementation, since it won't change anything regarding the current usage? |
|
This could also make 3rd party gems such as ActiveAdmin make it easier to work with their importmaps. As they can create a |
|
We are having this conversation in ActiveAdmin discussion thread here: activeadmin/activeadmin#8694 This would allow us to separate ActiveAdmin from frontend importmap. Currently, ActiveAdmin v4 requires importmap-rails in order to work. The issue is that How can we push this forward? |
Recently the
preloadoption was merged. But it comes with a huge penalty for a mental model. It is required for each dependency to set the preload for entrypoints. Depending on the number of items it can be hard to follow.Instead I believe this complexity can be solved with allowing multiple importmaps. But by default just work with a single one like today.
This removes the mental headache since a the dependencies in
config/importmaps/admin.rbcan be seen as a group. Without reading eachpreloadoption.This also allows to silo each importmap and reduce different dependencies to interfere with each other (e.g admin vs application).