webpacker: Adding webpacker to existing project breaks the application
Hi, I’m trying to add webpacker to an existing rails 5.1 application.
I don’t have anything non-standard at the moment.
I’m running ruby 2.4 and rails 5.1 and am using turbolinks.
The application has a few .js
files in app/assets/javascripts
, a few .scss
files in app/assets/stylesheets
and some images organized in subfolders in app/assets/images
.
I’m including the javascript with javascript_include_tag
(application.js
just requires all the files in the directory), stylesheets with stylesheet_link_tag
(application.scss
just requires all the files in the directory) and all the images in html.erb templates with image_tag
.
I added webpacker gem to Gemfile, ran bundle install
and rails webpacker:install
. Once I do this the app returns 500 upon every request. The issue is that the images that are loaded with image_tag
are no longer found. I get the error pasted below. I tried commenting out the images but then the problem is with the javascript_include_tag
with the same error.
ActionView::Template::Error (File to import not found or unreadable: outside.
Load paths:
...
What did I do wrong? Shouldn’t the existing images from app/assets/images
loaded with image_tag
still be working? And same for javascript_include_tag
…
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (8 by maintainers)
Ok, I understand. But this error is not happening when including css. It happens on the first appearance of
image_tag
. It looks that somehow, after installing webpacker gem and runningrails webpacker:install
, something regarding the assets changes. And that is causing the error to occur on the first occurrence of including any of the assets. Do you have any ideas what I could try to overcome this?