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

fix(js): allow pinning importmaps with gem #51

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

mhenrixon
Copy link
Contributor

@mhenrixon mhenrixon commented Feb 12, 2024

Since import maps JSPM and the javascript ecosystem are a mess in their current state, allow import maps to match the assets served by the gem rather than download them from JSPM.

@hopsoft I will test this and reply if it works, but according to ChatGPT and the action cable source code, this is how it could be done. It may only work for my scenario, but I unblock myself this way.

pin "@turbo-boost/streams", to: "@turbo-boost/streams.js", preload: false
pin "@turbo-boost/commands", to: "@turbo-boost/commands.js", preload: false
pin "@turbo-boost/elements", to: "@turbo-boost/elements.js", preload: false
pin "alpinejs", preload: false # @3.13.5
pin "@alpinejs/morph", to: "@alpinejs--morph.js", preload: false # @3.13.5

That fixes that problem; I'm happy with this solution for now; seems fair since JSPM never updates. Perhaps we can update the documentation for importmaps to the following:

  1. fix(js): allow pinning importmaps with gem #51
  2. fix(js): allow pinning importmaps with gem turbo_boost-commands#122
  3. fix(js): allow pinning importmaps with gem turbo_boost-elements#49

This is verified to be working with:

gem "turbo_boost-streams",  github: "mhenrixon/turbo_boost-streams"
gem "turbo_boost-commands", github: "mhenrixon/turbo_boost-commands"
gem "turbo_boost-elements", github: "mhenrixon/turbo_boost-elements"

Since import maps JSPM and the javascript ecosystem are a mess in their current state, allow import maps to match the assets served by the gem rather than download them from JSPM.
@hopsoft hopsoft changed the base branch from main to hopsoft/npm February 12, 2024 20:06
@hopsoft hopsoft merged commit 9f6c1cc into hopsoft:hopsoft/npm Feb 12, 2024
5 of 9 checks passed
hopsoft added a commit that referenced this pull request Feb 12, 2024
* Move from yarn to npm

* fix(js): allow pinning importmaps with gem (#51)

Since import maps JSPM and the javascript ecosystem are a mess in their current state, allow import maps to match the assets served by the gem rather than download them from JSPM.

---------

Co-authored-by: Mikael Henriksson <mikael@mhenrixon.com>
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

Successfully merging this pull request may close these issues.

2 participants