Skip to content

Commit 04b3c7f

Browse files
justin808Judahmeek
andcommitted
Upgrade to rails/webpacker v6 (#9)
* Upgrade to rails/webpacker v6 * Refactored code to use new merge capabilities of webpacker v6 * Updated to webpacker v6.beta.7 and React on Rails 12.2.0 Co-authored-by: Judah Meek <[email protected]>
1 parent 1f99714 commit 04b3c7f

17 files changed

+1466
-3598
lines changed

Gemfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
33

4-
ruby '2.7.2'
4+
ruby '2.7.3'
55

66
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
77
gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
@@ -47,8 +47,8 @@ end
4747
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
4848
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
4949

50-
gem "webpacker", "~> 5.2"
50+
gem "webpacker", "6.0.0.beta.7"
5151

52-
gem "react_on_rails", "12.0.3"
52+
gem "react_on_rails", "12.2.0"
5353

5454
gem 'mini_racer', platforms: :ruby

Gemfile.lock

+89-89
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (6.0.3.4)
5-
actionpack (= 6.0.3.4)
4+
actioncable (6.0.3.6)
5+
actionpack (= 6.0.3.6)
66
nio4r (~> 2.0)
77
websocket-driver (>= 0.6.1)
8-
actionmailbox (6.0.3.4)
9-
actionpack (= 6.0.3.4)
10-
activejob (= 6.0.3.4)
11-
activerecord (= 6.0.3.4)
12-
activestorage (= 6.0.3.4)
13-
activesupport (= 6.0.3.4)
8+
actionmailbox (6.0.3.6)
9+
actionpack (= 6.0.3.6)
10+
activejob (= 6.0.3.6)
11+
activerecord (= 6.0.3.6)
12+
activestorage (= 6.0.3.6)
13+
activesupport (= 6.0.3.6)
1414
mail (>= 2.7.1)
15-
actionmailer (6.0.3.4)
16-
actionpack (= 6.0.3.4)
17-
actionview (= 6.0.3.4)
18-
activejob (= 6.0.3.4)
15+
actionmailer (6.0.3.6)
16+
actionpack (= 6.0.3.6)
17+
actionview (= 6.0.3.6)
18+
activejob (= 6.0.3.6)
1919
mail (~> 2.5, >= 2.5.4)
2020
rails-dom-testing (~> 2.0)
21-
actionpack (6.0.3.4)
22-
actionview (= 6.0.3.4)
23-
activesupport (= 6.0.3.4)
21+
actionpack (6.0.3.6)
22+
actionview (= 6.0.3.6)
23+
activesupport (= 6.0.3.6)
2424
rack (~> 2.0, >= 2.0.8)
2525
rack-test (>= 0.6.3)
2626
rails-dom-testing (~> 2.0)
2727
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28-
actiontext (6.0.3.4)
29-
actionpack (= 6.0.3.4)
30-
activerecord (= 6.0.3.4)
31-
activestorage (= 6.0.3.4)
32-
activesupport (= 6.0.3.4)
28+
actiontext (6.0.3.6)
29+
actionpack (= 6.0.3.6)
30+
activerecord (= 6.0.3.6)
31+
activestorage (= 6.0.3.6)
32+
activesupport (= 6.0.3.6)
3333
nokogiri (>= 1.8.5)
34-
actionview (6.0.3.4)
35-
activesupport (= 6.0.3.4)
34+
actionview (6.0.3.6)
35+
activesupport (= 6.0.3.6)
3636
builder (~> 3.1)
3737
erubi (~> 1.4)
3838
rails-dom-testing (~> 2.0)
3939
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40-
activejob (6.0.3.4)
41-
activesupport (= 6.0.3.4)
40+
activejob (6.0.3.6)
41+
activesupport (= 6.0.3.6)
4242
globalid (>= 0.3.6)
43-
activemodel (6.0.3.4)
44-
activesupport (= 6.0.3.4)
45-
activerecord (6.0.3.4)
46-
activemodel (= 6.0.3.4)
47-
activesupport (= 6.0.3.4)
48-
activestorage (6.0.3.4)
49-
actionpack (= 6.0.3.4)
50-
activejob (= 6.0.3.4)
51-
activerecord (= 6.0.3.4)
52-
marcel (~> 0.3.1)
53-
activesupport (6.0.3.4)
43+
activemodel (6.0.3.6)
44+
activesupport (= 6.0.3.6)
45+
activerecord (6.0.3.6)
46+
activemodel (= 6.0.3.6)
47+
activesupport (= 6.0.3.6)
48+
activestorage (6.0.3.6)
49+
actionpack (= 6.0.3.6)
50+
activejob (= 6.0.3.6)
51+
activerecord (= 6.0.3.6)
52+
marcel (~> 1.0.0)
53+
activesupport (6.0.3.6)
5454
concurrent-ruby (~> 1.0, >= 1.0.2)
5555
i18n (>= 0.7, < 2)
5656
minitest (~> 5.1)
@@ -59,105 +59,105 @@ GEM
5959
addressable (2.7.0)
6060
public_suffix (>= 2.0.2, < 5.0)
6161
bindex (0.8.1)
62-
bootsnap (1.5.1)
62+
bootsnap (1.7.4)
6363
msgpack (~> 1.0)
6464
builder (3.2.4)
6565
byebug (11.1.3)
66-
capybara (3.33.0)
66+
capybara (3.35.3)
6767
addressable
6868
mini_mime (>= 0.1.3)
6969
nokogiri (~> 1.8)
7070
rack (>= 1.6.0)
7171
rack-test (>= 0.6.3)
72-
regexp_parser (~> 1.5)
72+
regexp_parser (>= 1.5, < 3.0)
7373
xpath (~> 3.2)
7474
childprocess (3.0.0)
75-
concurrent-ruby (1.1.7)
76-
connection_pool (2.2.3)
75+
concurrent-ruby (1.1.8)
76+
connection_pool (2.2.5)
7777
crass (1.0.6)
78-
erubi (1.9.0)
78+
erubi (1.10.0)
7979
execjs (2.7.0)
80-
ffi (1.13.1)
80+
ffi (1.15.0)
8181
globalid (0.4.2)
8282
activesupport (>= 4.2.0)
83-
i18n (1.8.5)
83+
i18n (1.8.10)
8484
concurrent-ruby (~> 1.0)
85-
jbuilder (2.10.1)
85+
jbuilder (2.11.2)
8686
activesupport (>= 5.0.0)
87-
libv8 (8.4.255.0)
88-
listen (3.3.0)
87+
libv8-node (15.14.0.0)
88+
listen (3.5.1)
8989
rb-fsevent (~> 0.10, >= 0.10.3)
9090
rb-inotify (~> 0.9, >= 0.9.10)
91-
loofah (2.7.0)
91+
loofah (2.9.1)
9292
crass (~> 1.0.2)
9393
nokogiri (>= 1.5.9)
9494
mail (2.7.1)
9595
mini_mime (>= 0.1.1)
96-
marcel (0.3.3)
97-
mimemagic (~> 0.3.2)
96+
marcel (1.0.1)
9897
method_source (1.0.0)
99-
mimemagic (0.3.5)
100-
mini_mime (1.0.2)
101-
mini_portile2 (2.4.0)
102-
mini_racer (0.3.1)
103-
libv8 (~> 8.4.255)
104-
minitest (5.14.2)
105-
msgpack (1.3.3)
106-
nio4r (2.5.4)
107-
nokogiri (1.10.10)
108-
mini_portile2 (~> 2.4.0)
98+
mini_mime (1.1.0)
99+
mini_portile2 (2.5.0)
100+
mini_racer (0.4.0)
101+
libv8-node (~> 15.14.0.0)
102+
minitest (5.14.4)
103+
msgpack (1.4.2)
104+
nio4r (2.5.7)
105+
nokogiri (1.11.3)
106+
mini_portile2 (~> 2.5.0)
107+
racc (~> 1.4)
109108
public_suffix (4.0.6)
110-
puma (4.3.6)
109+
puma (4.3.7)
111110
nio4r (~> 2.0)
111+
racc (1.5.2)
112112
rack (2.2.3)
113113
rack-proxy (0.6.5)
114114
rack
115115
rack-test (1.1.0)
116116
rack (>= 1.0, < 3)
117-
rails (6.0.3.4)
118-
actioncable (= 6.0.3.4)
119-
actionmailbox (= 6.0.3.4)
120-
actionmailer (= 6.0.3.4)
121-
actionpack (= 6.0.3.4)
122-
actiontext (= 6.0.3.4)
123-
actionview (= 6.0.3.4)
124-
activejob (= 6.0.3.4)
125-
activemodel (= 6.0.3.4)
126-
activerecord (= 6.0.3.4)
127-
activestorage (= 6.0.3.4)
128-
activesupport (= 6.0.3.4)
117+
rails (6.0.3.6)
118+
actioncable (= 6.0.3.6)
119+
actionmailbox (= 6.0.3.6)
120+
actionmailer (= 6.0.3.6)
121+
actionpack (= 6.0.3.6)
122+
actiontext (= 6.0.3.6)
123+
actionview (= 6.0.3.6)
124+
activejob (= 6.0.3.6)
125+
activemodel (= 6.0.3.6)
126+
activerecord (= 6.0.3.6)
127+
activestorage (= 6.0.3.6)
128+
activesupport (= 6.0.3.6)
129129
bundler (>= 1.3.0)
130-
railties (= 6.0.3.4)
130+
railties (= 6.0.3.6)
131131
sprockets-rails (>= 2.0.0)
132132
rails-dom-testing (2.0.3)
133133
activesupport (>= 4.2.0)
134134
nokogiri (>= 1.6)
135135
rails-html-sanitizer (1.3.0)
136136
loofah (~> 2.3)
137-
railties (6.0.3.4)
138-
actionpack (= 6.0.3.4)
139-
activesupport (= 6.0.3.4)
137+
railties (6.0.3.6)
138+
actionpack (= 6.0.3.6)
139+
activesupport (= 6.0.3.6)
140140
method_source
141141
rake (>= 0.8.7)
142142
thor (>= 0.20.3, < 2.0)
143143
rainbow (3.0.0)
144-
rake (13.0.1)
144+
rake (13.0.3)
145145
rb-fsevent (0.10.4)
146146
rb-inotify (0.10.1)
147147
ffi (~> 1.0)
148-
react_on_rails (12.0.3)
148+
react_on_rails (12.2.0)
149149
addressable
150150
connection_pool
151151
execjs (~> 2.5)
152152
rails (>= 3.2)
153153
rainbow (~> 3.0)
154154
webpacker (>= 4.0)
155-
regexp_parser (1.8.2)
155+
regexp_parser (2.1.1)
156156
rubyzip (2.3.0)
157157
selenium-webdriver (3.142.7)
158158
childprocess (>= 0.5, < 4.0)
159159
rubyzip (>= 1.2.2)
160-
semantic_range (2.3.0)
160+
semantic_range (3.0.0)
161161
spring (2.1.1)
162162
spring-watcher-listen (2.0.1)
163163
listen (>= 2.7, < 4.0)
@@ -170,20 +170,20 @@ GEM
170170
activesupport (>= 4.0)
171171
sprockets (>= 3.0.0)
172172
sqlite3 (1.4.2)
173-
thor (1.0.1)
173+
thor (1.1.0)
174174
thread_safe (0.3.6)
175-
tzinfo (1.2.8)
175+
tzinfo (1.2.9)
176176
thread_safe (~> 0.1)
177177
web-console (4.1.0)
178178
actionview (>= 6.0.0)
179179
activemodel (>= 6.0.0)
180180
bindex (>= 0.4.0)
181181
railties (>= 6.0.0)
182-
webdrivers (4.4.1)
182+
webdrivers (4.6.0)
183183
nokogiri (~> 1.6)
184184
rubyzip (>= 1.3.0)
185185
selenium-webdriver (>= 3.0, < 4.0)
186-
webpacker (5.2.1)
186+
webpacker (6.0.0.beta.7)
187187
activesupport (>= 5.2)
188188
rack-proxy (>= 0.6.1)
189189
railties (>= 5.2)
@@ -193,7 +193,7 @@ GEM
193193
websocket-extensions (0.1.5)
194194
xpath (3.2.0)
195195
nokogiri (~> 1.8)
196-
zeitwerk (2.4.1)
196+
zeitwerk (2.4.2)
197197

198198
PLATFORMS
199199
ruby
@@ -207,18 +207,18 @@ DEPENDENCIES
207207
mini_racer
208208
puma (~> 4.1)
209209
rails (~> 6.0.3, >= 6.0.3.1)
210-
react_on_rails (= 12.0.3)
210+
react_on_rails (= 12.2.0)
211211
selenium-webdriver
212212
spring
213213
spring-watcher-listen (~> 2.0.0)
214214
sqlite3 (~> 1.4)
215215
tzinfo-data
216216
web-console (>= 3.3.0)
217217
webdrivers
218-
webpacker (~> 5.2)
218+
webpacker (= 6.0.0.beta.7)
219219

220220
RUBY VERSION
221-
ruby 2.7.2p137
221+
ruby 2.7.3p183
222222

223223
BUNDLED WITH
224-
2.1.4
224+
2.2.14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.bold {
2+
color: green;
3+
}

app/javascript/bundles/HelloWorld/components/HelloWorld.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as React from 'react'
22
import { useState, FunctionComponent } from 'react'
3+
// @ts-ignore
4+
import style from './HelloWorld.module.css'
35

46
export interface Props {
57
name: string
@@ -15,7 +17,7 @@ const HelloWorld: FunctionComponent<Props> = (props: Props) => {
1517
<h3>Hello, {name}!</h3>
1618
<hr />
1719
<form>
18-
<label htmlFor="name">
20+
<label className={style.bold} htmlFor="name">
1921
Say hello to:
2022
<input
2123
id="name"

app/views/layouts/hello_world.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<title>ReactOnRailsWithWebpacker</title>
55
<%= csrf_meta_tags %>
66
<%= javascript_pack_tag 'hello-world-bundle' %>
7+
<%= stylesheet_pack_tag 'hello-world-bundle' %>
78
</head>
89

910
<body>

config/webpack/clientWebpackConfig.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const commonWebpackConfig = require('./commonWebpackConfig')
2+
3+
const configureClient = () => {
4+
const clientConfig = commonWebpackConfig()
5+
6+
// server-bundle is special and should ONLY be built by the serverConfig
7+
// In case this entry is not deleted, a very strange "window" not found
8+
// error shows referring to window["webpackJsonp"]. That is because the
9+
// client config is going to try to load chunks.
10+
delete clientConfig.entry['server-bundle']
11+
12+
return clientConfig
13+
}
14+
15+
module.exports = configureClient

config/webpack/clientWebpackConfiguration.js

-22
This file was deleted.

0 commit comments

Comments
 (0)