-
-
Notifications
You must be signed in to change notification settings - Fork 93
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 usage of RAILS_ENV #366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if you have a The only fully supported value of NODE_ENV is 'production'. Otherewise, we want to use 'development'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with supporting only the production or development here is that in some cases, you may have some assets that may need to be compiled in against test environment. Please see a more detailed explanation the bug #365. Additionally you may want to see the decidim/decidim#11728, in which, in order to fully fix the issue explained, i have ended up in having the TerserPlugin enabled on all my environments. I will shortly post a comment on #365 explaining how i got into this mess, and maybe the proposed fix, does not to be applied :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment was added #365 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alecslupu if you want a custom NODE_ENV, then why not just set it before running the scripts that invoke this command? |
||
new(argv).run | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see prior comment |
||
Shakapacker.ensure_log_goes_to_stdout do | ||
exit! unless Shakapacker.compile | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would there be no RAILS_ENV?
This is probably ok, as maybe it's weird to run the the dev_server_runner outside of development?
The part of the shakapacker.yml used is based on the RAILS_ENV.
https://github.com/shakacode/shakapacker/blob/master/lib/shakapacker/configuration.rb#L130