Webpacker: webpack-dev-server --lazy

Created on 27 Mar 2018  路  3Comments  路  Source: rails/webpacker

https://webpack.js.org/configuration/dev-server/ provides a 'lazy' configuration to avoid compiling all scripts up front for larger projects.

I've tried settings this flag in webpacker.yml as well as via environment variable WEBPACK_DEV_SERVER_LAZY=true as well as via the --lazy argument to bin/webpack-dev-server to no success.

Does webpacker.yml not pass through all config? Please advise =)

Most helpful comment

@iChip You could add this option in development.js using environment config.

// config/webpack/development.js
environment.config.devServer.lazy = true

module.exports = environment.toWebpackConfig()

All 3 comments

@iChip You could add this option in development.js using environment config.

// config/webpack/development.js
environment.config.devServer.lazy = true

module.exports = environment.toWebpackConfig()

Thanks for the prompt response!

I tried this, it does start the server lazily but it appears when i request a page, webpacker expects the assets to already exist rather than requesting them from the server (?)

ActionView::Template::Error (Webpacker can't find manifest.js in {...}/public/packs/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }

All my controller tests are returning the following error by default. The actual test written passes but this is some annoying test that is just showing by default when the command 'rails test:controllers' is run. Can someone please help?

`E

Error:
ContactsControllerTest#test_GET_new:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/contacts_controller_test.rb:5:in `block in <class:ContactsControllerTest>'

bin/rails test test/controllers/contacts_controller_test.rb:4

E

Error:
ContactsControllerTest#test_POST_create:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/contacts_controller_test.rb:28:in `block in <class:ContactsControllerTest>'

bin/rails test test/controllers/contacts_controller_test.rb:17

E

Error:
ContactsControllerTest#test_invalid_POST_create:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
app/controllers/contacts_controller.rb:12:in `create'
test/controllers/contacts_controller_test.rb:34:in `block in <class:ContactsControllerTest>'

bin/rails test test/controllers/contacts_controller_test.rb:33

E

Error:
PagesControllerTest#test_should_get_careproviders:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:26:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:25

E

Error:
PagesControllerTest#test_should_get_emar:
NameError: undefined local variable or method pages_emar_url' for #<PagesControllerTest:0x00007fac7c7e2270> test/controllers/pages_controller_test.rb:32:inblock in '

bin/rails test test/controllers/pages_controller_test.rb:31

E

Error:
PagesControllerTest#test_should_get_contactus:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:50:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:49

E

Error:
PagesControllerTest#test_should_get_pharmacy:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:20:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:19

E

Error:
PagesControllerTest#test_should_get_home:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:14:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:13

E

Error:
PagesControllerTest#test_should_get_faqs:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:38:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:37

E

Error:
PagesControllerTest#test_should_get_news:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:44:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:43

E

Error:
PagesControllerTest#test_should_get_root:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:9:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:8

E

Error:
PagesControllerTest#test_should_get_updates:
ActionView::Template::Error: Webpacker can't find application.js in /Users/mansoor/code/manisureal/Caremeds/public/packs-test/manifest.json. Possible causes:

  1. You want to set webpacker.yml value of compile to true for your environment
    unless you are using the webpack -w or the webpack-dev-server.
  2. webpack has not yet re-run to reflect updates.
  3. You have misconfigured Webpacker's config/webpacker.yml file.
  4. Your webpack configuration is not creating a manifest.
    Your manifest contains:
    {
    }
app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb__3112584982020566817_70189368606160'
test/controllers/pages_controller_test.rb:56:in `block in <class:PagesControllerTest>'

bin/rails test test/controllers/pages_controller_test.rb:55`

Was this page helpful?
0 / 5 - 0 ratings