Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit cdf7948

Browse files
committed
Update exception when React.js is not defined
1 parent 70d2868 commit cdf7948

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

lib/reactive-ruby.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@
55
raise [
66
"No React.js Available",
77
"",
8-
"React.js must be defined before requiring 'reactive-ruby'",
9-
"'reactive-ruby' has been tested with react v13, v14, and v15.",
8+
"A global `React` must be defined before requiring 'reactive-ruby'",
109
"",
11-
"IF USING 'react-rails':",
12-
" add 'require \"react\"' immediately before the 'require \"reactive-ruby\" directive in 'views/components.rb'.",
10+
"To USE THE BUILT-IN SOURCE: ",
11+
" add 'require \"react/react-source\"' immediately before the 'require \"reactive-ruby\" directive.",
1312
"IF USING WEBPACK:",
14-
" add 'react' to your webpack manifest.",
15-
"OTHERWISE TO GET THE LATEST TESTED VERSION",
16-
" add 'require \"react-latest\"' immediately before the require of 'reactive-ruby',",
17-
"OR TO USE A SPECIFIC VERSION",
18-
" add 'require \"react-v1x\"' immediately before the require of 'reactive-ruby'."
13+
" add 'react' to your webpack manifest."
1914
].join("\n")
2015
end
2116
require 'react/top_level'

lib/reactrb.rb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
if RUBY_ENGINE == 'opal'
44
if `window.React === undefined || window.React.version === undefined`
5-
raise "No React.js Available\n\n"\
6-
"React.js must be defined before requiring 'reactrb'\n"\
7-
"'reactrb' has been tested with react v13, v14, and v15.\n\n"\
8-
"IF USING 'react-rails':\n"\
9-
" add 'require \"react\"' immediately before the 'require \"reactive-ruby\" "\
10-
"directive in 'views/components.rb'.\n"\
11-
"IF USING WEBPACK:\n"\
12-
" add 'react' to your webpack manifest.\n"\
13-
"OTHERWISE TO GET THE LATEST TESTED VERSION\n"\
14-
" add 'require \"react-latest\"' immediately before the require of 'reactrb',\n"\
15-
"OR TO USE A SPECIFIC VERSION\n"\
16-
" add 'require \"react-v1x\"' immediately before the require of 'reactrb'."
5+
raise [
6+
"No React.js Available",
7+
"",
8+
"A global `React` must be defined before requiring 'reactrb'",
9+
"",
10+
"To USE THE BUILT-IN SOURCE: ",
11+
" add 'require \"react/react-source\"' immediately before the 'require \"reactrb\" directive.",
12+
"IF USING WEBPACK:",
13+
" add 'react' to your webpack manifest."
14+
].join("\n")
1715
end
1816
require 'react/hash'
1917
require 'react/top_level'

0 commit comments

Comments
 (0)