-
Notifications
You must be signed in to change notification settings - Fork 8
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
The path is not recognized when using importmap #5
Comments
I'm having almost the same issue. But, mine wasn't working on production environment. I'm getting:
It works on development environment though. I'm using CDN too atm. |
I have the same issue in production |
Same issue on my end. I documented the issue here: |
I'm gonna take a look into this as soon as I have some free time. |
This issue is the js file is not being placed in the correct path to be served in rails7. I would just remove the gem entirely and pin it yourself:
|
Indeed, when removing the gem, running Edit: Thanks @jantunes |
Hey, v0.0.7 was released with the fix from #6, let me know if that did fix your problems! https://rubygems.org/gems/requestjs-rails/versions/0.0.7 Huge thanks to @d6rkaiz! |
Thanks a lot for taking the time to check it out so quickly. Really appreciated! I created a new Rails 7 app and ran the normal install (gemfile + bundle install + ./bin/rails requestjs:install). My Gemfile.lock is The normal install did add |
Hi! So I tried again from a brand new Rails 7 app, created a scaffold for Post. Let me know if need to do a different install. |
@GGrassiant Could you test with the gem "requestjs-rails", github: "rails/requestjs-rails", branch: "main" I tested it here and it seems that it is working now but I want to make sure before I release a new version that everything is OK. Thanks for your patience! |
@GGrassiant @kirillplatonov Just a small detail, did change the import back to |
Just updated to 0.0.7 and it broke my app saying the same as below. It was working fine until the update. The original issue sounds like a user configuration error and not an issue with the package. In regards to the second issue brought up it is expected with importmaps and Firefox etc according to the importmaps-rails readme: https://github.com/rails/importmap-rails#expected-errors-from-using-the-es-module-shim.
|
@coder2000 Can you point the gem to the github repo and see if it works again? |
@marcelolx Awesome! I just
Works perfectly locally. I also deployed to Heroku and it works flawlessly as well! No console error, no issue whatsoever. Thanks a lot for taking the time to look into it and fix the issue. This is really appreciated. 🚀 |
Nice, will drop a new release soon! And sorry for those that have been affected with the latest broken release, shouldn't have released it. |
Thanks for your time! It works great for me too. I have a question just out of curiosity. Why is it added to importmap automatically from the engine, instead of adding to the main importmap.rb file of the application? This differs from the behavior that turbo-rails or stimulus-rails has, where we have the imports manually added by the gem installer into our application's importmap.rb file. Thanks! |
That works, thanks. |
@brunoprietog There's no specific reason, it was this way since the beginning (in the early days turbo/stimulus-rails also did it this way hotwired/turbo-rails@36477e2#diff-a6c9ea9b91a99345ff04b9597b41369bc2552724c7c00135db376ff782aaf7ab). From what I can see here https://github.com/rails/importmap-rails#composing-import-maps in some ways it is encouraged to do it from the engine. |
Release v0.0.8 https://rubygems.org/gems/requestjs-rails/versions/0.0.8 I did also yank v0.0.7 since it was broken |
I use rails/requestjs-rails with rails/request.js with esbuild. v0.0.7 worked fine and now it broke something: ruby-3.1.0/gems/railties-7.0.1/lib/rails/railtie/configuration.rb:96:in had to roll back to 0.0.6 Is it me or...? |
@mithos99 With esbuild do you don't have a It's not you, I did remove that check but seems that it is required in your case. I was just not expecting someone using this gem with esbuild when you can install it directly with npm/yarn |
Sure I did. Then I added
So do I need requestjs-rails gem for my config or yarn add is enough? I'm so confused... |
@mithos99 If you want to stick with the gem, please try using the main branch to see if it works again (if it is working again I'll release a new version)
I have to update the README of the request.js repo (and add probably a new task in here to support esbuild), there have been so many changes that I forgot to update the description there. But basically, if you have a
Yarn add should be enough. |
With just "yarn add @rails/request.js" and no gem works fine. |
Apologies for asking (new dev :) ), but I've done "yarn add @rails/request.js" and I am still not able to load the JS. I wonder if somehow, this issue is related. CAMPANAZZO git:(master) heroku logs | grep c4d5d71c-acc5-4270-b5d9-9330c2a4328e |
@wilsoncelyCUC can you give more context? Are you using esbuild? Is this app in a public repo or could you create a sample app that I could reproduce? If it works in your dev environment but does not in production, I suppose you're missing something in the build step? |
Hello!
Using Rails 7 and importmap, I added this gem and ran the installation steps.
However, it only adds the @rails/request.js import in application.js, without adding it to importmap.rb.
I tried to add it manually using any of these options:
And I get the following, as appropriate:
Then, I executed:
And I got the same result, even though the URL is associated in importmap.rb.
I removed the gem and everything was solved. Now I am using the CDN.
What could be happening?
Something extra I didn't mention is that I'm using propshaft, will it affect anything?
Thanks!
The text was updated successfully, but these errors were encountered: