importmap-rails icon indicating copy to clipboard operation
importmap-rails copied to clipboard

importmap timeago and date-fns: missing dependencies

Open bmedici opened this issue 1 year ago • 1 comments

Hi everyone,

When trying to use timeago as a stimulus controller, date-fns is downloaded and pinned correctly with:

bin/importmap pin @stimulus-components/timeago

But all its dependencies are still missing, and a lot of 404 in the logs:

ActionController::RoutingError (No route matches [GET] "/assets/addHours.js"):
ActionController::RoutingError (No route matches [GET] "/assets/addMilliseconds.js"):
ActionController::RoutingError (No route matches [GET] "/assets/addISOWeekYears.js"):
ActionController::RoutingError (No route matches [GET] "/assets/addDays.js"):
ActionController::RoutingError (No route matches [GET] "/assets/add.js"):
...

Seems related to https://github.com/rails/importmap-rails/issues/264

Any idea on how to solve this, with a workaround or something I may have missed ?

Thanks

bmedici avatar Dec 13 '24 17:12 bmedici

If anyone is still stuck on this, following the advice from 288, I was able to get it working by placing the following in my importmap.rb

# Gerated using https://generator.jspm.io/#U2VhYGBiDs0rySzJSU1hcCguycwtzSkt1k3Ozy3Iz0vNKynWBwqlJqbnO5jqGegZMaQklqTqpuUVO5joGeoZAADfwVbEQAA
pin "@stimulus-components/timeago", to: "https://ga.jspm.io/npm:@stimulus-components/[email protected]/dist/stimulus-timeago.mjs" # @5.0.2
pin "date-fns", to: "https://ga.jspm.io/npm:[email protected]/index.js" # @4.1.0

TheRoyalTnetennba avatar Feb 05 '25 23:02 TheRoyalTnetennba