-
Notifications
You must be signed in to change notification settings - Fork 123
Confusion between the :to
and :under
options of pin_all_from
#67
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
I think I figured out what's going on. The importmap-rails/lib/importmap/map.rb Line 136 in 27236e3
But, this only works if the value passed to pin_all_from "app/javascript/spina/controllers", under: "spina/controllers" If the value to pin_all_from "app/javascript/spina/controllers", under: "controllers/spina", to: "spina/controllers" In this case, as well, the value passed to the Feel free to correct me if I missed out on anything. If you want me to raise a PR to document this scenario in the I still feel that this could be improved so that the pin_under "controllers/spina", all: "spina/controllers" This does 2 things:
But this obviously includes a change in the public API, so it is up for debate. Another way can also be to just to modify the pin "controllers/spina", under: "spina/controllers" Note that in this case, I also noticed that this issue is overlapping with #66 so I'm just mentioning that here. |
https://trello.com/c/O1mjkISk After successfully deploying a test company application to `fly.io`, we noticed that our custom js files weren't working. The problem was how we import custom js files. We use relative imports the custom js files in the `application.js` which works in the development but it breaks in production. [1] To solve this problem we need to pin all files in custom fractalsoft directory in `importmaps.rb` and change the import in `application.js`. [2][3] [1]: https://stackoverflow.com/questions/70548841/how-to-add-custom-js-file-to-new-rails-7-project [2]: rails/importmap-rails#66 [3]: rails/importmap-rails#67
https://trello.com/c/O1mjkISk After successfully deploying a test company application to `fly.io`, we noticed that our custom js files weren't working. The problem was how we import custom js files. We use relative imports the custom js files in the `application.js` which works in the development but it breaks in production. [1] To solve this problem we need to pin all files in custom fractalsoft directory in `importmaps.rb` and change the import in `application.js`. [2][3] [1]: https://stackoverflow.com/questions/70548841/how-to-add-custom-js-file-to-new-rails-7-project [2]: rails/importmap-rails#66 [3]: rails/importmap-rails#67
I was testing the
pin_all_from
method and found what might be a potential issue.pin_all_from
requires both the:to
and:under
options to be passed for this test case to pass:importmap-rails/test/importmap_test.rb
Lines 50 to 53 in 27236e3
This is also apparent by removing the line:
importmap-rails/test/importmap_test.rb
Line 13 in 27236e3
from the setup and noticing that the tests still pass. I also verified it by creating a new Rails 7 app and adding both the lines:
importmap-rails/test/importmap_test.rb
Lines 13 to 14 in 27236e3
to
config/importmap.rb
and runningbin/importmap json
. Commenting out the second line doesn't generate any imports but commenting out the first line does.The text was updated successfully, but these errors were encountered: