Skip to content

Commit

Permalink
3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravtiwari committed Mar 23, 2018
1 parent eb1a637 commit d418bcf
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
**Please note that Webpacker 3.1.0 and 3.1.1 has some serious bugs so please consider using either 3.0.2 or 3.2.0**

## [3.4.0] - 2018-03-23

## Added
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)

*This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode*


## [3.3.1] - 2018-03-12

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
webpacker (3.3.1)
webpacker (3.4.0)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
Expand Down
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ in which case you may not even need the asset pipeline. This is mostly relevant
- [Usage](#usage)
- [Development](#development)
- [Webpack Configuration](#webpack-configuration)
- [Custom Rails environments](#custom-rails-environments)
- [Upgrading](#upgrading)
- [Yarn Integrity](#yarn-integrity)
- [Integrations](#integrations)
Expand Down Expand Up @@ -195,6 +196,56 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
See [docs/webpack](docs/webpack.md) for modifying webpack configuration and loaders.


### Custom Rails environments

Out of the box Webpacker ships with - development, test and production environments in `config/webpacker.yml` however, in most production apps extra environments are needed as part of deployment workflow. Webpacker supports this out of the box from version 3.4.0+ onwards.

You can choose to define additional environment configurations in webpacker.yml,

```yml
staging:
<<: *default

# Production depends on precompilation of packs prior to booting for performance.
compile: false

# Cache manifest.json for performance
cache_manifest: true

# Compile staging packs to a separate directory
public_output_path: packs-staging
```

or, Webpacker will use production environment as a fallback environment for loading configurations. Please note, `NODE_ENV` can either be set to `production` or `development`.
This means you don't need to create additional environment files inside `config/webpacker/*` and instead use webpacker.yml to load different configurations using `RAILS_ENV`.

For example, the below command will compile assets in production mode but will use staging configurations from `config/webpacker.yml` if available or use fallback production environment configuration:

```bash
RAILS_ENV=staging bundle exec rails assets:precompile
```

And, this will compile in development mode and load configuration for cucumber environment
if defined in webpacker.yml or fallback to production configuration

```bash
RAILS_ENV=cucumber NODE_ENV=development bundle exec rails assets:precompile
```

Please note, binstubs compiles in development mode however rake tasks
compiles in production mode.

```bash
# Compiles in development mode unless NODE_ENV is specified
./bin/webpack
./bin/webpack-dev-server

# compiles in production mode by default unless NODE_ENV is specified
bundle exec rails assets:precompile
bundle exec rails webpacker:compile
```


### Upgrading

You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related npm modules:
Expand Down
2 changes: 1 addition & 1 deletion lib/webpacker/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Webpacker
# Change the version in package.json too, please!
VERSION = "3.3.1".freeze
VERSION = "3.4.0".freeze
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rails/webpacker",
"version": "3.3.1",
"version": "3.4.0",
"description": "Use webpack to manage app-like JavaScript modules in Rails",
"main": "package/index.js",
"files": [
Expand Down

0 comments on commit d418bcf

Please sign in to comment.