webpacker: Compiling in production fails silently and isn't verbose enough
I have a Rails 5.2 app with Webpacker 4.0.0.pre.3 with runs smoothly in development and instead couldn’t compile in production: [Webpacker] Compiling…
just hanged there for hours (locally and on Heroku, where @schneems helped me a lot), in a similar way as described in #1534, #1217 and #1003.
After many hours of testing and research I found out that the problem was that two dependencies in package.json
(@fortawesome/fontawesome-free and expose-loader) were in devDependencies
instead of dependencies
, that made compiling failing silently.
Running this command put me on the right path to find the solution, giving me some hits of errors NODE_ENV=production ./bin/webpack --progress --config config/webpack/production.js
.
Problem is that instad running RAILS_ENV=production NODE_ENV=production bundle exec rails assets:compile
didn’t give me any indication of errors, and I don’t know why but shouldn’t be the case.
What do you think?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 18
- Comments: 16 (10 by maintainers)
A thing I’ve had to recommend fairly frequently is to manually run
./bin/webpack --progress
.Can we make this the default output mode of webpacker? Any other documentation or tips on debugging hung or really slow compiles is appreciated.
+1 to what @schneems said above with respect to making
--progress
the webpacker default@schneems If you also add
--profile
, this will give you some insight into where the bottlenecks are:We use a progress plugin that does this on every build, here is one that a lot of
(react/vue/angular)-cli
libraries use: https://www.npmjs.com/package/simple-progress-webpack-plugin#minimal@jakeNiemiec I think the issue here is
Open3
is hanging for some reason when there is error returned from the shell command. I am looking into alternatives but if someone has ideas feel free to make a PR.I’ll try the stats config and to revert the fix to see if the errors are displayed, thank you @jakeNiemiec!
@jakeNiemiec are you sure that that is what it’s happening? Why moving the libraries from
devDependencies
todependencies
should fix that? Compiling with./bin/webpack
was giving me errors, but Webpacker didn’t. EDIT: I didn’t have problems with long compiling times in reality, I think. I had problems with compiling errors not being reported and not halting the process.@rossta amazing thanks! Issue closed 😃