Skip to content

Commit b8050f9

Browse files
committed
Upgrade to react_on_rails v9 series.
1 parent e16f037 commit b8050f9

File tree

9 files changed

+113
-53
lines changed

9 files changed

+113
-53
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ node_modules
2323

2424
# Generated js bundles
2525
/public/webpack/*
26+
/public/packs/*
27+
/public/packs-test/*
2628
reactchat.sublime-workspace
2729
.DS_Store
2830
/public/assets/*

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gem 'omniauth-github'
1313

1414
gem 'jquery-rails'
1515

16-
gem 'react_on_rails', '~> 8.0.6'
16+
gem 'react_on_rails', '~> 9.0.3'
1717

1818
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
1919
gem 'rails', '~> 5.1.4'
@@ -63,4 +63,4 @@ end
6363
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
6464

6565
gem 'mini_racer', platforms: :ruby
66-
gem 'webpacker_lite'
66+
gem 'webpacker'

Gemfile.lock

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ GEM
4545
bindex (0.5.0)
4646
builder (3.2.3)
4747
byebug (9.1.0)
48-
capybara (2.15.1)
48+
capybara (2.15.3)
4949
addressable
5050
mini_mime (>= 0.1.3)
5151
nokogiri (>= 1.3.3)
@@ -118,7 +118,7 @@ GEM
118118
multi_json (~> 1.3)
119119
multi_xml (~> 0.5)
120120
rack (>= 1.2, < 3)
121-
omniauth (1.7.0)
121+
omniauth (1.7.1)
122122
hashie (>= 3.4.6, < 3.6.0)
123123
rack (>= 1.6.2, < 3)
124124
omniauth-github (1.3.0)
@@ -132,6 +132,8 @@ GEM
132132
public_suffix (3.0.0)
133133
puma (3.10.0)
134134
rack (2.0.3)
135+
rack-proxy (0.6.2)
136+
rack
135137
rack-test (0.7.0)
136138
rack (>= 1.0, < 3)
137139
rails (5.1.4)
@@ -163,7 +165,7 @@ GEM
163165
rb-fsevent (0.10.2)
164166
rb-inotify (0.9.10)
165167
ffi (>= 0.5.0, < 2)
166-
react_on_rails (8.0.6)
168+
react_on_rails (9.0.3)
167169
addressable
168170
connection_pool
169171
execjs (~> 2.5)
@@ -174,7 +176,7 @@ GEM
174176
railties (>= 4.2.0, < 5.3)
175177
ruby_dep (1.5.0)
176178
rubyzip (1.2.1)
177-
sass (3.5.1)
179+
sass (3.5.2)
178180
sass-listen (~> 4.0.0)
179181
sass-listen (4.0.0)
180182
rb-fsevent (~> 0.9, >= 0.9.4)
@@ -217,9 +219,9 @@ GEM
217219
activemodel (>= 5.0)
218220
bindex (>= 0.4.0)
219221
railties (>= 5.0)
220-
webpacker_lite (2.1.0)
222+
webpacker (3.0.2)
221223
activesupport (>= 4.2)
222-
multi_json (~> 1.2)
224+
rack-proxy (>= 0.6.1)
223225
railties (>= 4.2)
224226
websocket-driver (0.6.5)
225227
websocket-extensions (>= 0.1.0)
@@ -244,7 +246,7 @@ DEPENDENCIES
244246
pg
245247
puma
246248
rails (~> 5.1.4)
247-
react_on_rails (~> 8.0.6)
249+
react_on_rails (~> 9.0.3)
248250
sass-rails
249251
selenium-webdriver
250252
spring
@@ -253,7 +255,7 @@ DEPENDENCIES
253255
tzinfo-data
254256
uglifier
255257
web-console
256-
webpacker_lite
258+
webpacker
257259

258260
RUBY VERSION
259261
ruby 2.4.1p111

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"js-yaml": "^3.8.2",
2727
"react": "^15.5.4",
2828
"react-dom": "^15.5.4",
29-
"react-on-rails": "8.0.6",
29+
"react-on-rails": "9.0.3",
3030
"webpack": "^2.3.3",
3131
"webpack-manifest-plugin": "^1.1.0"
3232
},

client/webpack.config.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ const ManifestPlugin = require('webpack-manifest-plugin');
99
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
1010

1111
const configPath = resolve('..', 'config');
12-
const { devBuild, manifest, webpackOutputPath, webpackPublicOutputDir } =
13-
webpackConfigLoader(configPath);
12+
const { output, settings } = webpackConfigLoader(configPath);
13+
const devBuild = process.env.NODE_ENV === 'development';
14+
const isHMR = devBuild ? settings.dev_server.hmr : false;
15+
1416

1517
const config = {
1618

@@ -26,12 +28,11 @@ const config = {
2628
},
2729

2830
output: {
29-
// Name comes from the entry section.
30-
filename: '[name]-[hash].js',
31+
filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js',
32+
chunkFilename: '[name]-[chunkhash].chunk.js',
3133

32-
// Leading slash is necessary
33-
publicPath: `/${webpackPublicOutputDir}`,
34-
path: webpackOutputPath,
34+
publicPath: output.publicPath,
35+
path: output.path,
3536
},
3637

3738
resolve: {
@@ -43,7 +44,10 @@ const config = {
4344
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
4445
DEBUG: false,
4546
}),
46-
new ManifestPlugin({ fileName: manifest, writeToFileEmit: true }),
47+
new ManifestPlugin({
48+
publicPath: output.publicPath,
49+
writeToFileEmit: true
50+
})
4751
],
4852

4953
module: {

client/yarn.lock

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,10 @@ [email protected]:
14821482
version "2.16.3"
14831483
resolved "http://registry.npm.taobao.org/hoek/download/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
14841484

1485+
hoist-non-react-statics@^2.2.1:
1486+
version "2.3.1"
1487+
resolved "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"
1488+
14851489
home-or-tmp@^2.0.0:
14861490
version "2.0.0"
14871491
resolved "http://registry.npm.taobao.org/home-or-tmp/download/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
@@ -1553,7 +1557,7 @@ interpret@^1.0.0:
15531557
version "1.0.4"
15541558
resolved "http://registry.npm.taobao.org/interpret/download/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0"
15551559

1556-
invariant@^2.2.0, invariant@^2.2.2:
1560+
invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.2:
15571561
version "2.2.2"
15581562
resolved "http://registry.npm.taobao.org/invariant/download/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360"
15591563
dependencies:
@@ -1795,7 +1799,11 @@ loader-utils@^1.0.2:
17951799
emojis-list "^2.0.0"
17961800
json5 "^0.5.0"
17971801

1798-
"lodash@>=3.5 <5", lodash@^4.14.0, lodash@^4.17.4:
1802+
lodash-es@^4.2.0:
1803+
version "4.17.4"
1804+
resolved "http://registry.npm.taobao.org/lodash-es/download/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7"
1805+
1806+
"lodash@>=3.5 <5", lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0:
17991807
version "4.17.4"
18001808
resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
18011809

@@ -2213,9 +2221,23 @@ react-dom@^15.5.4:
22132221
object-assign "^4.1.0"
22142222
prop-types "^15.5.10"
22152223

2216-
2217-
version "8.0.6"
2218-
resolved "http://registry.npm.taobao.org/react-on-rails/download/react-on-rails-8.0.6.tgz#b0f30772a850dca6fa2c508576455557a2dd40ea"
2224+
[email protected], react-on-rails@^9.0.0-beta.12:
2225+
version "9.0.3"
2226+
resolved "http://registry.npm.taobao.org/react-on-rails/download/react-on-rails-9.0.3.tgz#da8a9873a94d62fe91e1f80d76716583f2be9da7"
2227+
dependencies:
2228+
react-on-rails "^9.0.0-beta.12"
2229+
react-redux "^5.0.6"
2230+
2231+
react-redux@^5.0.6:
2232+
version "5.0.6"
2233+
resolved "http://registry.npm.taobao.org/react-redux/download/react-redux-5.0.6.tgz#23ed3a4f986359d68b5212eaaa681e60d6574946"
2234+
dependencies:
2235+
hoist-non-react-statics "^2.2.1"
2236+
invariant "^2.0.0"
2237+
lodash "^4.2.0"
2238+
lodash-es "^4.2.0"
2239+
loose-envify "^1.1.0"
2240+
prop-types "^15.5.10"
22192241

22202242
react@^15.5.4:
22212243
version "15.6.2"

config/initializers/react_on_rails.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# If you are using the ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
1919
# with rspec then this controls what yarn command is run
2020
# to automatically refresh your webpack assets on every test run.
21-
config.npm_build_test_command = "yarn run build:test"
21+
config.build_test_command = "yarn run build:test"
2222

2323
# This configures the script to run to build the production assets by webpack. Set this to nil
2424
# if you don't want react_on_rails building this file for you.
25-
config.npm_build_production_command = "yarn run build:production"
25+
config.build_production_command = "yarn run build:production"
2626

2727
################################################################################
2828
# CLIENT RENDERING OPTIONS

config/webpacker.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Note: You must restart bin/webpack-dev-server for changes to take effect
2+
3+
default: &default
4+
source_path: app/javascript
5+
source_entry_path: packs
6+
public_output_path: packs
7+
cache_path: tmp/cache/webpacker
8+
9+
# Additional paths webpack should lookup modules
10+
# ['app/assets', 'engine/foo/app/assets']
11+
resolved_paths: []
12+
13+
# Reload manifest.json on all requests so we reload latest compiled packs
14+
cache_manifest: false
15+
16+
extensions:
17+
- .coffee
18+
- .erb
19+
- .js
20+
- .jsx
21+
- .ts
22+
- .vue
23+
- .sass
24+
- .scss
25+
- .css
26+
- .png
27+
- .svg
28+
- .gif
29+
- .jpeg
30+
- .jpg
31+
32+
development:
33+
<<: *default
34+
compile: true
35+
36+
dev_server:
37+
host: localhost
38+
port: 3035
39+
hmr: false
40+
https: false
41+
42+
test:
43+
<<: *default
44+
compile: true
45+
46+
# Compile test packs to a separate directory
47+
public_output_path: packs-test
48+
49+
production:
50+
<<: *default
51+
52+
# Production depends on precompilation of packs prior to booting for performance.
53+
compile: false
54+
55+
# Cache manifest.json for performance
56+
cache_manifest: true
57+

config/webpacker_lite.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)