File tree 1 file changed +23
-7
lines changed
1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change 1
- var execSync = require ( 'child_process' ) . execSync
2
1
var stat = require ( 'fs' ) . stat
3
2
4
- function exec ( command ) {
5
- execSync ( command , { stdio : [ 0 , 1 , 2 ] } )
6
- }
7
-
8
3
stat ( 'lib' , function ( error , stat ) {
9
- if ( error || ! stat . isDirectory ( ) )
10
- exec ( 'npm run build' )
4
+ if ( error || ! stat . isDirectory ( ) ) {
5
+ console . warn (
6
+ '-' . repeat ( 79 ) + '\n' +
7
+ 'Built output not found. It looks like you might be attempting to install React\n' +
8
+ 'Router from GitHub. React Router sources need to be transpiled before use. We\n' +
9
+ 'will now make a best-efforts attempt to transpile the code. This will only work\n' +
10
+ 'if your development environment is set up appropriately.\n' +
11
+ '-' . repeat ( 79 )
12
+ )
13
+
14
+ try {
15
+ var execSync = require ( 'child_process' ) . execSync
16
+ execSync ( 'npm run build' , { stdio : [ 0 , 1 , 2 ] } )
17
+ } catch ( e ) {
18
+ console . error (
19
+ '-' . repeat ( 79 ) + '\n' +
20
+ 'Failed to build React Router automatically. Please install React Router from\n' +
21
+ 'npm, or clone the repo locally and build the library manually.\n' +
22
+ '-' . repeat ( 79 )
23
+ )
24
+ throw ( e )
25
+ }
26
+ }
11
27
} )
You can’t perform that action at this time.
0 commit comments