[DO NOT MERGE] Spike importmaps - #5790
Draft
andysellick wants to merge 7 commits into
Draft
Conversation
- should be automatically included in Rails 7+, but seems like it needs to be installed manually - ran command `bundle add importmap-rails`
- ran command `./bin/rails importmap:install` - the result is probably wrong for our config, but keeping this in a separate commit for clarity before reconfiguring - critically it failed to add anything to the application layout file, which we probably need to address in the layout component
andysellick
force-pushed
the
importmaps
branch
from
September 11, 2026 07:32
ab3fc4c to
51f7828
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Spiking importmaps to try to allow the map component to work with ES modules.
References:
Note: this requires the line
<%= javascript_importmap_tags %>to be added to the components gem, specifically in the HEAD of the public layout component, and in the component guide layout template HEAD.Here's why this is difficult.
assets.rbdefraandmaplibredependencies, which the map code needs to importnode_modulesso I created new files thatrequireeach of them, and put them into the new place for JS (app/javascript)defraormaplibrestart using their ownimport x from ycommands, which fail because those other things don't exist (maplibrerelies on babel, for example)This isn't working yet, and I think it might be possible to get there, but the effort and maintenance burden is beginning to look a little high.
Why
See #5716
https://gov-uk.atlassian.net/jira/software/c/projects/PNP/boards/1356?selectedIssue=PNP-10149
Visual changes