diff --git a/lib/shakapacker/dev_server_runner.rb b/lib/shakapacker/dev_server_runner.rb index 5133c2b34..933934a23 100644 --- a/lib/shakapacker/dev_server_runner.rb +++ b/lib/shakapacker/dev_server_runner.rb @@ -21,7 +21,7 @@ def load_config @config = Configuration.new( root_path: app_root, config_path: Pathname.new(@shakapacker_config), - env: ENV["RAILS_ENV"] + env: ENV["RAILS_ENV"] || "development" ) dev_server = DevServer.new(@config) diff --git a/lib/shakapacker/runner.rb b/lib/shakapacker/runner.rb index 5c8074375..35c7181ec 100644 --- a/lib/shakapacker/runner.rb +++ b/lib/shakapacker/runner.rb @@ -2,7 +2,7 @@ module Shakapacker class Runner def self.run(argv) $stdout.sync = true - ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development" + ENV["NODE_ENV"] ||= ENV["RAILS_ENV"] || "development" new(argv).run end diff --git a/lib/tasks/shakapacker/compile.rake b/lib/tasks/shakapacker/compile.rake index 30bd39be3..5ac4aa25c 100644 --- a/lib/tasks/shakapacker/compile.rake +++ b/lib/tasks/shakapacker/compile.rake @@ -3,7 +3,7 @@ $stdout.sync = true namespace :shakapacker do desc "Compile JavaScript packs using webpack for production with digests" task compile: ["shakapacker:verify_install", :environment] do - Shakapacker.with_node_env(ENV.fetch("NODE_ENV", "production")) do + Shakapacker.with_node_env(ENV.fetch("NODE_ENV", ENV["RAILS_ENV"] || "production")) do Shakapacker.ensure_log_goes_to_stdout do exit! unless Shakapacker.compile end