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

Css not loaded in production

Open hugoh59 opened this issue 4 years ago • 3 comments

Steps to reproduce

Create a .css file and import it into a .jsx file. It works locally but when pushing to heroku the css isnt loaded.

Expected behavior

Dev and prod behaves the same way

Actual behavior

Heroku does not load css and it's super annoying.

System configuration

"dependencies": { "@babel/preset-react": "^7.6.3", "@rails/actioncable": "^6.0.0-alpha", "@rails/activestorage": "^6.0.0-alpha", "@rails/ujs": "^6.0.0-alpha", "@rails/webpacker": "^4.0.7", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "css-loader": "2.1.1", "prop-types": "^15.7.2", "react": "^16.10.2", "react-dom": "^16.10.2", "react-facebook": "^8.0.4", "react-stripe-elements": "^5.0.1", "react_ujs": "^2.6.0", "turbolinks": "^5.2.0" }, "version": "0.1.0", "devDependencies": { "webpack-dev-server": "^3.8.2" }

Using ruby 2.6.0 and Rails 6.0.0

hugoh59 avatar Oct 18 '19 08:10 hugoh59

Can you precompile your assets locally? If so is your CSS file emitted at the location referred to by the stylesheet_pack_tag?

As an aside, this is likely to be a webpack or webpacker issue, doesn't sound related to this gem but I'll help if I'm able to.

BookOfGreg avatar Oct 18 '19 08:10 BookOfGreg

Have the same issue, pushed a project to heroku that uses uppy, and the uppy css is not being included in the production version. did you ever find a solution @hugoh59 ?

mofmn avatar Oct 29 '20 14:10 mofmn

Just an update if anyone googles this and needs a solution, my solution was to change stylesheet_link_tag to stylesheet_pack_tag in views/layouts/application.html.erb

mofmn avatar Nov 04 '20 13:11 mofmn

Closing the issue as we have a solution for this here.

alkesh26 avatar Nov 08 '22 10:11 alkesh26