Hey there,
i have upgraded to 1.1 and everything is working in development with dev-server, and building the assets for production is working very well.
The problem is that the compiled packs (disabled dev-server) are served where they are supposed to be, but the helper function does not find the javascript files:
undefined method `lookup_asset_for_path' for #<#<Class:0x007ff52d74b178>:0x007ff52d749da0>
Did you mean? lookup_context
For that line:
<%= javascript_pack_tag 'angular_frontend' %>
The generated file is there and the mapping in the manifest.json seems also correct.
{
"angular_frontend.js": "/packs/angular_frontend-bad05fdf82d8cbe321a0.js"
}
My angular frontend is in:
app/javascript/angular_frontend
and the pack file is:
app/javascript/packs/angular_frontend.js:
require('../angular_frontend');
@KillerCodeMonkey Did you re-run the webpacker installer? bundle exec rails webpacker:install
If you have installed angular then you would need to run bundle exec rails webpacker:install:angular
See #184
yeah i did, if not i would not have all the new files like the loaders, paths.yml and so. Like i said every thing is generated correctly.
And it is explicit working with dev-server, but not without. The manifest seems valid. And the files are in the public/packs folder.
It looks more like, rails did not find the public/packs folder as assets or something like that. :(
What version of Rails and Sprockets are you using?
thank you for your replies,
rails (5.0.2)
actioncable (= 5.0.2)
actionmailer (= 5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
activemodel (= 5.0.2)
activerecord (= 5.0.2)
activesupport (= 5.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.2)
sprockets-rails (>= 2.0.0)
...
GIT
remote: https://github.com/rails/webpacker.git
revision: c4d912dbee884c192a436261189f806e26f7bf95
specs:
webpacker (1.1)
activesupport (>= 4.2)
multi_json (~> 1.2)
railties (>= 4.2)
Right. Is it using this sprocket version?
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
Also, how is your config/application.rb looks?
yep, it is using this sprockets version.
and application.rb:
# frozen_string_literal: true
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module MyModule
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.i18n.default_locale = :de
config.autoload_paths += Dir[Rails.root.join('lib')]
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
end
end
hey, i solved it --> we added a sprockets error gem, which causes this.
Thanks for your help!
@gauravtiwari @KillerCodeMonkey I don't seem to have a sprockets error gem, but I have the same issue.
I have the same verison of rails and sprockets linked above.
I'm consuming webpacker (1.2)
manifest.json
{
"application.js": "/packs/application-847eb20e089c21c270f2.js",
"home.css": "/packs/home-908fa4839ae87fac1f6f.css",
"home.js": "/packs/home-c1fb93b2a383699f8b7b.js"
}
➜ ls -l public/packs
total 1088
application-847eb20e089c21c270f2.js
application-847eb20e089c21c270f2.js.gz
home-908fa4839ae87fac1f6f.css
home-c1fb93b2a383699f8b7b.js
home-c1fb93b2a383699f8b7b.js.gz
manifest.json
md5-54f55fe11817a3c0e723129c053dec72
<link rel="stylesheet" media="screen" href="/packs/home-908fa4839ae87fac1f6f.css">
md5-83c23bd9a3038779c195705423ea6ce5
requests like http://localhost:3000/packs/home-908fa4839ae87fac1f6f.css 404.
Any hints?
Thanks
What solved it for me was rm -rf tmp/cache/ and restarting the rails server (Rails 5.1).
Most helpful comment
@gauravtiwari @KillerCodeMonkey I don't seem to have a sprockets error gem, but I have the same issue.
I have the same verison of rails and sprockets linked above.
I'm consuming
webpacker (1.2)manifest.json
requests like
http://localhost:3000/packs/home-908fa4839ae87fac1f6f.css404.Any hints?
Thanks