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

Change NODE_ENV defaults #185

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Changes since last non-beta release.

_Please add entries here for your pull requests that are not yet released._
- Fixed NODE_ENV default and moved it from binstubs to the runner [PR 185](https://github.com/shakacode/shakapacker/pull/185) by [mage1711](https://github.com/mage1711).

## [v6.5.1] - August 15, 2022

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ Note, if you are using server-side rendering of JavaScript with dynamic code-spl
### Development

Webpacker ships with two binstubs: `./bin/webpacker` and `./bin/webpacker-dev-server`. Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js` executables to ensure that the right configuration files and environmental variables are loaded based on your environment.
The setting of the NODE_ENV should be removed from the binstubs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go to the changelog, not here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go to the changelog, not here.

I added it to the changelog also https://github.com/shakacode/shakapacker/pull/185/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR10

and I think we should keep this line or move it somewhere else because the old binstubs will still have the old NODE_ENV defaults if a new install isn't done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change, @mage1711:

Older Shakapacker installations had the setting of a missing NODE_ENV in the binstubs as the default per RAILS_ENV is no longer set there.


#### Automatic Webpack Code Building

Expand Down
1 change: 0 additions & 1 deletion lib/install/bin/webpacker
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require "webpacker"
require "webpacker/webpack_runner"

ENV["RAILS_ENV"] ||= "development"
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)

APP_ROOT = File.expand_path("..", __dir__)
Expand Down
1 change: 0 additions & 1 deletion lib/install/bin/webpacker-dev-server
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby

ENV["RAILS_ENV"] ||= "development"
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Expand Down
2 changes: 1 addition & 1 deletion lib/webpacker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Webpacker
class Runner
def self.run(argv)
$stdout.sync = true

ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
new(argv).run
end

Expand Down