Ruby Sprockets v4.0 upgrade FileNotFound (assets extension mismatch .coffee, .scss - mime types?)

250 Views Asked by At

I recently updated my app to use Sprockets 4.0: https://www.rubydoc.info/gems/sprockets/4.0.0 I introduced the manifest.js file as described here: https://github.com/rails/sprockets/blob/master/UPGRADING.md

My current assets are described in: application.coffee, application.light.coffee, application.scss, application.light.scss files. On starting the server I get errors of type:

  • couldn't find file 'jquery' with type 'text/coffeescript'
    • Asset is available with .js extension.
  • couldn't find file 'select2' with type 'text/scss'
    • Asset is available with .css extention.

I was previously using sprockets v3.7; the gemfiles have correctly been added. I have tried clearing the tmp/cache after upgrading.

Can someone recommend the path forward here. I have cross-checked all threads for this question. So far I am resorting to renaming application.coffee -> application.js, application.cscc -> application.css but it doesn't look like the ideal solution.

manifest.js

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
1

There are 1 best solutions below

0
On

The issue was arising because we were precompiling few assets using Rails.application.config.assets.precompile - application.light.coffee, application.light.scss

Once I removed this the issue with extension stopped surfacing. If anyone has context to why the above errors were thrown will help to clarify the answer.