@@ -4,9 +4,11 @@ var React = require('react');
44var ReactDOMServer = require ( 'react-dom/server' ) ;
55var createMemoryHistory = require ( 'history/lib/createMemoryHistory' ) ;
66var babelCore = require ( 'babel-core' ) ;
7- var babelConfig = { } ;
7+ var babelConfig = {
8+ presets : [ "es2015" , "react" ]
9+ } ;
810
9- var origJsLoader = require . extensions [ '.js' ] ;
11+ var origJsLoader = require . extensions [ '.js' ] ;
1012require . extensions [ '.js' ] = loadViaBabel ;
1113require . extensions [ '.jsx' ] = loadViaBabel ;
1214
@@ -20,7 +22,7 @@ function findReactComponent(options) {
2022 }
2123 return loadedModule [ options . exportName ] ;
2224 } else if ( typeof loadedModule === 'function' ) {
23- // Otherwise, if the module itself is a function, assume that is the component
25+ // Otherwise, if the module itself is a function, assume that is the component
2426 return loadedModule ;
2527 } else if ( typeof loadedModule . default === 'function' ) {
2628 // Otherwise, if the module has a default export which is a function, assume that is the component
@@ -33,11 +35,11 @@ function findReactComponent(options) {
3335function loadViaBabel ( module , filename ) {
3436 // Assume that all the app's own code is ES2015+ (optionally with JSX), but that none of the node_modules are.
3537 // The distinction is important because ES2015+ forces strict mode, and it may break ES3/5 if you try to run it in strict
36- // mode when the developer didn't expect that (e.g., current versions of underscore.js can't be loaded in strict mode).
38+ // mode when the developer didn't expect that (e.g., current versions of underscore.js can't be loaded in strict mode).
3739 var useBabel = filename . indexOf ( 'node_modules' ) < 0 ;
3840 if ( useBabel ) {
3941 var transformedFile = babelCore . transformFileSync ( filename , babelConfig ) ;
40- return module . _compile ( transformedFile . code , filename ) ;
42+ return module . _compile ( transformedFile . code , filename ) ;
4143 } else {
4244 return origJsLoader . apply ( this , arguments ) ;
4345 }
0 commit comments