Skip to content

Packs not being compiled on-demand in development environment #673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
speckins opened this issue Aug 20, 2017 · 3 comments
Closed

Packs not being compiled on-demand in development environment #673

speckins opened this issue Aug 20, 2017 · 3 comments

Comments

@speckins
Copy link

According to the README, webpacker compiles on demand in the development environment:

In development, Webpacker compiles on demand rather than upfront by default. This happens when you refer to any of the pack assets using the Webpacker helper methods. That means you don't have to run any separate process. Compilation errors are logged to the standard Rails log.

In a new Rails 5.1.3 application generated with --webpack and with the following modifications:

app/views/layouts/application.html.erb
<%= javascript_pack_tag 'application' %>

config/routes.rb
root to: 'application#index'

app/views/application/index.html
Empty file

...I get the following error:

Webpacker::FileLoader::NotFoundError in Application#index
Can't find application.js in ~/rails513-webpack/public/packs/manifest.json. Is webpack still compiling?

After a manual invocation of "bin/rake webpacker:compile", the application.js pack loads without error but fails to update on-demand when app/javascript/packs/application.js is modified, as the documentation above would indicate it should.

(Tested on rails master - 5.2.0.alpha just now; same behavior. Also probably a duplicate of #671.)

@gauravtiwari
Copy link
Member

It’s on latest master (unreleased) and you have to reinstall webpacker.

@speckins
Copy link
Author

Ah, thanks @gauravtiwari

Confirmed. Adding the following to the Gemfile...

gem 'webpacker', github: "rails/webpacker"

...followed by bundle install and bin/rake webpacker:install and the packs are now being built on-demand.

@gauravtiwari
Copy link
Member

Awesome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants