After shifting from webpacker to importmaps in Rails 7. I keep getting this error no matter what I do to resolve it. Following is the output of the error.
I, [2022-12-02T11:33:16.828698 #2401] INFO -- : [ca024b47-6054-444f-ab01-7f92d98e099f] Started GET "/" for 127.0.0.1 at 2022-12-02 11:33:16 +0500I, [2022-12-02T11:33:16.858168 #2401] INFO -- : [ca024b47-6054-444f-ab01-7f92d98e099f] Processing by Devise::SessionsController#new as HTMLI, [2022-12-02T11:33:17.079797 #2401] INFO -- : [ca024b47-6054-444f-ab01-7f92d98e099f] Rendered /Users/hamzaaamir/.rvm/gems/ruby-3.1.0/gems/devise-4.8.1/app/views/devise/sessions/new.html.erb within layouts/application (Duration: 10.1ms | Allocations: 3457)I, [2022-12-02T11:33:17.080678 #2401] INFO -- : [ca024b47-6054-444f-ab01-7f92d98e099f] Rendered layout layouts/application.html.erb (Duration: 11.0ms | Allocations: 4035)I, [2022-12-02T11:33:17.080831 #2401] INFO -- : [ca024b47-6054-444f-ab01-7f92d98e099f] Completed 500 Internal Server Error in 223ms (ActiveRecord: 74.8ms | Allocations: 17972)F, [2022-12-02T11:33:17.081562 #2401] FATAL -- : [ca024b47-6054-444f-ab01-7f92d98e099f] [ca024b47-6054-444f-ab01-7f92d98e099f] ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.):[ca024b47-6054-444f-ab01-7f92d98e099f] 6: <%= csrf_meta_tags %>[ca024b47-6054-444f-ab01-7f92d98e099f] 7: <%= csp_meta_tag %>[ca024b47-6054-444f-ab01-7f92d98e099f] 8: [ca024b47-6054-444f-ab01-7f92d98e099f] 9: <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>[ca024b47-6054-444f-ab01-7f92d98e099f] 10: <%= javascript_importmap_tags %>[ca024b47-6054-444f-ab01-7f92d98e099f] 11: </head>[ca024b47-6054-444f-ab01-7f92d98e099f] 12: [ca024b47-6054-444f-ab01-7f92d98e099f] [ca024b47-6054-444f-ab01-7f92d98e099f] app/views/layouts/application.html.erb:9
I have run the importmaps rake task and added sassc-rails
to compile my CSS files. It works fine in the development environment but produces errors in production. I have also run rails assets:precompile
.
My code in assets/config/manifest.js
//= link_tree ../images//= link_directory ../stylesheets .css//= link_tree ../../javascript .js//= link_tree ../../../vendor/javascript .js
My code in assets/stylesheets/application.scss
@import "bootstrap";@import "./dashboard.scss";@import "./sidebar.scss";