Repository navigation
Webpack required Components file not found first boot #5
Description
Following Hyperloop Webpack Tutorial doesn't quite work first boot.
Declare your React library in app/javascript/packs/client_and_server.js:
ReactMaterialize = require("react-materialize");Run the command webpack, so it will generate the package client_and_server.js into public/packs
Tell Hyperloop where is located your package:
# config/initializers/hyperloop.rb:
config.import 'client_and_server'In order to help Rails and Hyperloop to find the client_and_server.js package:
# config/initializers/assets.rb
Rails.application.config.assets.paths << Rails.root.join('public', 'packs')But there is some kind of bug. I did the above, cleared cache and started the server but it refused to boot: couldn't find file 'client_and_server' with type 'application/javascript' (Sprockets::FileNotFound). However I can see the ./public/packs folder in the lookup paths in the error output below, so the config is correct.
I got it to work by commenting out `config.import 'client_and_server' and booting the server once. Of course Hyperloop can't find the component but at least the app boots this time.
Then I stop the server, add the config.import line back and restart the server. This time it can find the file and boots and the component works in Hyperloop.
So, what is Rails doing on that first boot that bin/webpack didn't do? Our webpacker config is stock but I note yours is different, perhaps Rails changed something.
I just reproduced the issue in our app by rm -rf tmp/cache again. You don't even have to load the app in a browser, just booting the app is enough.
Error Output
=> Booting Puma => Rails 5.1.4 application starting in development => Run `rails server -h` for more startup options##########################################################################
HYPERLOOP LIBRARIES PRECOMPILING AND MINIFYING
FIRST TIME BOOTING YOUR APP IT CAN TAKE 1 OR 2 MINUTES
NB: You can force precompiling again by cleaning cache: rm -rf tmp/cache
##########################################################################Compiling the system assets for hyperloop-prerender-loader-system-code
'
require 'opal'
require 'hyperloop-config'
require 'hyper-component'
require 'hyper-model'
require 'hyper-store'
require 'react/react-source-browser'
require 'react/react-source-server' # SERVER ONLY
require 'hyper-react'
require 'hyper-operation'
require 'reactrb/auto-import'
require 'hyper-router'
require 'hyper-router/react-router-source'
require 'hyper-i18n'
require 'hyper-console'
require 'opal_hot_reloader'
require 'models/000_application_record'
require 'client_and_server'
Exiting
/Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/resolve.rb:65:inresolve!': couldn't find file 'client_and_server' with type 'application/javascript' (Sprockets::FileNotFound) Checked in these paths: /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/opal /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/stdlib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyperloop-config-0.9.11/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-jquery-0.4.2/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-store-0.2.3/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-activesupport-0.3.0/opal /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-react-0.12.7/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/react-rails-1.9.0/lib/assets/react-source/development-with-addons /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-react-0.12.7/lib/react-sources /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-component-0.12.3/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mutations-0.8.1/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-operation-0.5.12/lib/sources /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-operation-0.5.12/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-operation-0.5.12/vendor /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-mesh-0.6.0/lib/sources /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-mesh-0.6.0/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-mesh-0.6.0/vendor /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-model-0.6.0/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-browser-0.2.0/opal /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/paggio-0.2.6/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-router-4.1.1/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/hyper-i18n-6a3e0ce43f0f/lib /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal_hot_reloader-0.1.4/opal /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-console-0.1.4/lib /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/assets/flash /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/assets/fonts /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/assets/images /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/assets/javascripts /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/assets/stylesheets /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/vendor/assets/javascripts /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/vendor/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyper-console-0.1.4/vendor/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-rails-0.9.3/lib/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/sibyl-1b2d5a5ebeec/app/assets/images /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/sibyl-1b2d5a5ebeec/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/sibyl-1b2d5a5ebeec/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/app/assets/images /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/vendor/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/vendor/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/nested_form-0.3.2/vendor/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jquery-ui-rails-5.0.5/app/assets/images /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jquery-ui-rails-5.0.5/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jquery-ui-rails-5.0.5/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/font-awesome-rails-4.7.0.2/app/assets/fonts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/font-awesome-rails-4.7.0.2/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/remotipart-1.3.1/vendor/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/cocoon-1.2.10/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/zeroclipboard-rails-0.1.2/app/assets/images /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/zeroclipboard-rails-0.1.2/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jquery-rails-4.3.1/vendor/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/fonts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/coffee-rails-4.2.2/lib/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actioncable-5.1.4/lib/assets/compiled /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionview-5.1.4/lib/assets/compiled /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/hyperloop /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/hyperloop /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/app/views /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/node_modules /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/public/packs /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/react-rails-1.9.0/lib/assets/react-source/development /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/react-rails-1.9.0/lib/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/stylesheets /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/javascripts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/fonts /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/materialize-sass-0.97.7/app/assets/images from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/context.rb:88:inresolve'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:259:inresolve_with_compat' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/context.rb:142:inrequire_asset'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/lib/opal/sprockets/processor.rb:69:inblock in process_requires' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/lib/opal/sprockets/processor.rb:67:ineach'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/lib/opal/sprockets/processor.rb:67:inprocess_requires' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/opal-0.10.5/lib/opal/sprockets/processor.rb:48:inevaluate'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/tilt-2.0.8/lib/tilt/template.rb:109:inrender' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy_tilt_processor.rb:25:incall'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:incall_processor' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:inblock in call_processors'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:inreverse_each' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:incall_processors'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:inload_from_unloaded' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:inblock in load'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:infetch_asset_from_dependency_cache' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:inload'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:inblock in initialize' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:inload'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:inblock in call' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:indfs'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:incall' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:incall_processor'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:inblock in call_processors' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:inreverse_each'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:incall_processors' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:inload_from_unloaded'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:inblock in load' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:infetch_asset_from_dependency_cache'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:inload' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:inblock in initialize'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:inload' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:infind_asset'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/environment.rb:30:infind_asset' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:92:in[]'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyperloop-config-0.9.11/lib/hyperloop/imports.rb:105:incompile_and_compress' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyperloop-config-0.9.11/lib/hyperloop-prerender-loader-system.js.erb:1:in_evaluate_template'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/erb_processor.rb:26:incall' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/erb_processor.rb:13:incall'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:incall_processor' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:inblock in call_processors'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:inreverse_each' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:incall_processors'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:inload_from_unloaded' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:inblock in load'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:infetch_asset_from_dependency_cache' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:inload'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:inblock in initialize' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:inload'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:inblock in call' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:indfs'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:incall' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:incall_processor'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:inblock in call_processors' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:inreverse_each'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:incall_processors' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:inload_from_unloaded'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:inblock in load' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:infetch_asset_from_dependency_cache'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:inload' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:inblock in initialize'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:inload' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:infind_asset'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/environment.rb:30:infind_asset' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/hyperloop-config-0.9.11/lib/hyperloop/rail_tie.rb:56:inblock in class:Railtie'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:67:inblock in execute_hook' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:inwith_execution_control'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:inexecute_hook' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:inblock in run_load_hooks'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:ineach' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:inrun_load_hooks'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:73:inblock in <module:Finisher>' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:ininstance_exec'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:inrun' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:inblock in run_initializers'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:228:inblock in tsort_each' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:431:ineach_strongly_connected_component_from' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:349:inblock in each_strongly_connected_component'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:ineach' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:incall'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:ineach_strongly_connected_component' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:226:intsort_each'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:205:intsort_each' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:inrun_initializers'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:ininitialize!' from /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/config/environment.rb:5:in
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:inrequire' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:inrequire'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:inblock in require' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:inload_dependency'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:inrequire' from config.ru:2:inblock in '
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:ininstance_eval' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:ininitialize'
from config.ru:innew' from config.ru:in'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:ineval' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:innew_from_string'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:inparse_file' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:319:inbuild_app_and_options_from_config'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:219:inapp' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:inapp'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:354:inwrapped_app' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:80:inlog_to_stdout'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:42:instart' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:inblock in perform'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:intap' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:inperform'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:inrun' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:ininvoke_command'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:indispatch' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:inperform'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:ininvoke' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:inrequire' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bootsnap-1.1.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:inrequire'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:inblock in require' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:inload_dependency'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:inrequire' from /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/bin/rails:9:in<top (required)>'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:inload' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:incall'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:incall' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:inrun'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in<top (required)>' from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:inload'
from /Users/sfcgeorge/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in<top (required)>' from /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/bin/spring:15:inrequire'
from /Users/sfcgeorge/Documents/Websites/Work/JobLab/code/joblab/bin/spring:15:in<top (required)>' from bin/rails:3:inload'
from bin/rails:3:in `'
Other issues with the docs:
- Doesn't mention having to run
webpack(noob info I know but important) - I don't understand the asset pipeline option, surely it can't work as plain JS doesn't understand ES6
require()and I get errors to that effect? - Not clear why there are 3 places to import JS stuff (webpack packs, asset manifest, hyperloop config).
- Since it's in the asset pipeline and webpack tag, surely these components are loaded twice?
Activity
sfcgeorge commentedon Oct 3, 2017
The default configuration of Webpacker is to generate digests on all the packed files and store the mapping in
manifest.json. Example contents:I don't know the internals of the include mechanism / Sprockets but it seems it's not looking via the manifest so can't find the file as it has a digest.
Rails
asset_pack_pathcorrectly uses the manifest to do the lookup. Internally that callsWebpacker.manifest.lookup. Inside gems likereact-railsthey also use that lookup helper. So a fix for this issue is using lookup inhyperloop.rb:Which works provided the packs folder is added to the asset pipeline as above:
It's a little messy but does work. Another work around is to prevent generation of the digest by changing the webpack defaults. But I assume this is a bad idea as it will probably cause caching issues, but I'm not sure:
So hyperloop-config could be changed to automatically look via the manifest.json. But this may not be possible as you can't know what is an asset or what is a webpack thing, maybe an additional explicit option
config.import "server_and_client", webpack: trueAnd/or the Webpack example could be updated to mention the above workaround[s].
sfcgeorge commentedon Oct 13, 2017
I also believe that adding
javascript_pack_tagas well as the require inhyperloop.rbdoes cause the libraries to be duplicated as I got errors in the browser to that effect. So don't add the pack tag, just the require and it seems to work.catmando commentedon Nov 15, 2017
So I am not sure what the conclusion of this will be but it should be either fixed, or at least documented/clarified with 0.15 release
janbiedermann commentedon Dec 11, 2017
Rails.application.config.assets.paths << Rails.root.join('public', 'packs')This should NOT be done, sprockets should not have webpacker output paths in its load_path.
I recommend to use the javascript_pack_tag for the client and for prerendering the new config.prerendering_files = ["your_webpack_bundle.js", "your_sprockets_files.js", "hyperloop-prerender-loader.js"] option, which knows how to access webpacker files.
@sfcgeorge please confirm it working for you
It should then be documented
sfcgeorge commentedon Dec 15, 2017
Yep, now working without that adding packs to assets hack line.