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

Commit ec7f3ca

Browse files
committed
Changes to not include source unless specified
1 parent 82ab7c2 commit ec7f3ca

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

lib/hyper-router.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
if RUBY_ENGINE == 'opal'
2-
# require 'reactrb' # how to require this conditionally????
2+
no_source = `Opal.global.ReactRouter === undefined`
3+
if no_source
4+
error = <<-ERROR
5+
No react-router.js Available.
6+
7+
A global `ReactRouter` must be defined before requiring 'hyper-router'.
8+
9+
To USE THE BUILT-IN SOURCE:
10+
add 'require \"hyper-router/react-router-source\"'
11+
immediately before the 'require \"hyper-router\" directive.
12+
13+
IF USING NPM/WEBPACK:
14+
add "react-router": "~2.4.0" to your package.json.)
15+
ERROR
16+
raise error
17+
end
318
require 'hyper-react'
419
require 'promise'
520
require 'promise_extras'
6-
require 'react/router/react-router'
721
require 'react/router'
822
require 'react/router/dsl'
923
require 'react/router/dsl/route'
@@ -16,5 +30,4 @@
1630
require 'react/router/version'
1731

1832
Opal.append_path File.expand_path('../', __FILE__).untaint
19-
Opal.append_path File.expand_path('../../vendor', __FILE__).untaint
2033
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# rubocop:disable
2+
require 'src/react-router.js'

0 commit comments

Comments
 (0)