-
-
Notifications
You must be signed in to change notification settings - Fork 630
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
Fix exit code of webpack build by adding --bail #730
Conversation
d702e9d
to
f17fb5d
Compare
2 similar comments
Travis fails, but it seems random failure not related to this PR..? |
@ypresto I'm not quite sure on what exactly is this fixing. Can you provide some example? Should this change get merged over to: https://github.com/shakacode/react-webpack-rails-tutorial CC: @squadette, since you might make some changes for webpack v2. |
I'm using wercker (CI service) and calling But webpack does not return exit code other than zero when without --bail option so CI cannot fail even there is a error raised by webpack. Then our CI (and perhaps assets:precompile on deploy) missed compile error and we unexpectedly deployed app which does not work... |
Are you using the built-in deployment via automatic rake precompile task? @ypresto can you please try on a very simple case of webpack failing, with and with out the https://github.com/shakacode/react_on_rails/blob/master/lib/tasks/assets.rake#L55 # Sprockets independent tasks
namespace :react_on_rails do
namespace :assets do
desc <<-DESC
Compile assets with webpack
Uses command defined with ReactOnRails.configuration.npm_build_production_command
sh "cd client && `ReactOnRails.configuration.npm_build_production_command`"
DESC
task webpack: :environment do
if ReactOnRails.configuration.npm_build_production_command.present?
sh "cd client && #{ReactOnRails.configuration.npm_build_production_command}"
end
end
end
end @robwise @alexfedoseev I think the bug is that we're not forcing the rake task to fail on the line that's running: By contrast, I think we're doing the correct thing here: # You can replace this implementation with your own for use by the
# ReactOnRails::TestHelper.ensure_assets_compiled helper
module ReactOnRails
module TestHelper
class WebpackAssetsCompiler
def compile_assets
puts "\nBuilding Webpack assets..."
build_output = `cd client && #{ReactOnRails.configuration.npm_build_test_command}`
raise "Error in building assets!\n#{build_output}" unless Utils.last_process_completed_successfully?
puts "Completed building Webpack assets."
end
end
end
end @ypresto Given all this, would it make more sense to just change the code around assets.rake rather than recommending @robwise @alexfedoseev any opnions? I opened up issue #730. |
@ypresto Any comments? |
Is this one of those differences between backticks and |
Yes, we call Putting syntax error in with
|
WTF -- webpack v1.x does not return an exist status of non-zero without |
Yes, it is absolutely confusing feature which should only be enabled with |
@ypresto This was fixed in Webpack v2. So I won't change the defaults installer for the --bail, but rather for webpack v2. |
Without --bail webpack error returns exit code of 0 which is ignored by CI services.
webpack/webpack#708 (comment)
This change is