Description
I've the problem that in my current project, webpack-dev-server hangs when first started:
→ ./bin/webpack-dev-server
11% building modules 10/10 modules 0 active
Project is running at http://localhost:3035/
webpack output is served from /packs/
Content not from webpack is served from/Users/.../public/packs
404s will fallback to /index.html
66% building modules 468/469 modules 1 active ...xternal_application_form/index.js.erb
It sometimes hangs at some other point, eg.:
67% building modules 479/480 modules 1 active ..._custom_question_answers_form.vue.erb
so the hang is not consistent, but it always displays some .erb
at the end of output.
If I cancel the dev server and restart it, it goes through without a problem:
→ ./bin/webpack-dev-server
11% building modules 10/10 modules 0 active Project is running at http://localhost:3035/
webpack output is served from /packs/
Content not from webpack is served from /Users/.../public/packs 404s will fallback to /index.html
Hash: 6b8d3991aafe09cef922 Version: webpack 3.5.6
Time: 8058ms
[...]
I noticed that it happens only when spring was not started before. If spring is started already (e.g. because of a rails console
), the compilation goes through on first try without the need to cancel it first.
Additionally, when I disable spring by commenting out the spring loader from bin/rails
, it always goes through without a problem, too. So I suspect it to be the combination of spring and the rails erb loader that makes it hang somehow (or is anything else calling bin/rails
during compiling?)
I tried to set a timeout for rails-erb-loader
by editing node_modules/rails-erb-loader/index.js
, suspecting a hang while compiling the erb assets, but this did not change anything (still hangs).
How can we debug this further to see where exactly it hangs and why? Alternatively, adding an option to disable spring for the webpack dev server might be a way to mitigate the symptom.
Edit: Using rails-erb-loader@^5.2.1 and webpacker gem 3.0.1, rails 5.1.4 and spring 2.0.2