Skip to content
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

Webpack dev server with spring hangs #785

Closed
doits opened this issue Sep 11, 2017 · 3 comments
Closed

Webpack dev server with spring hangs #785

doits opened this issue Sep 11, 2017 · 3 comments

Comments

@doits
Copy link
Contributor

doits commented Sep 11, 2017

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

@doits
Copy link
Contributor Author

doits commented Sep 12, 2017

I just found out about the DISABLE_SPRING env, so when I run DISABLE_SPRING=1 ./bin/webpack-dev-server it skips spring and works without a problem.

Still interesting why it fails with spring imo.

@gauravtiwari
Copy link
Member

@doits May be open an issue on rails-erb-loader repo 👍

@doits
Copy link
Contributor Author

doits commented Sep 14, 2017

Right, done, usabilityhub/rails-erb-loader#47

@doits doits closed this as completed Sep 14, 2017
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