2
2
* Taken and modified from react-proxy-loader to support react-router
3
3
* willTransitionTo hooks. See "BEGIN CHANGE" - "END CHANGE" below.
4
4
*/
5
+ var loaderUtils = require ( "loader-utils" ) ;
6
+
5
7
module . exports = function ( ) { } ;
6
8
module . exports . pitch = function ( remainingRequest ) {
7
9
this . cacheable && this . cacheable ( ) ;
10
+ var query = loaderUtils . parseQuery ( this . query ) ;
11
+
8
12
var moduleRequest = "!!" + remainingRequest ;
9
13
return [
10
14
'var React = require("react");' ,
@@ -25,7 +29,7 @@ module.exports.pitch = function(remainingRequest) {
25
29
' else {' ,
26
30
' callback();' ,
27
31
' }' ,
28
- ' });' ,
32
+ ' }' + ( query . name ? ', ' + JSON . stringify ( query . name ) : '' ) + ' );',
29
33
' },' ,
30
34
' willTransitionFrom: function(transition, component, callback) {' ,
31
35
' if (component && component.willTransitionFrom) {' ,
@@ -46,7 +50,7 @@ module.exports.pitch = function(remainingRequest) {
46
50
' require.ensure([], function() {' ,
47
51
' component = require(' + JSON . stringify ( moduleRequest ) + ');' ,
48
52
' if(callback) callback(component);' ,
49
- ' });' ,
53
+ ' }' + ( query . name ? ', ' + JSON . stringify ( query . name ) : '' ) + ' );',
50
54
' } else if(callback) callback(component);' ,
51
55
' return component;' ,
52
56
' }' ,
0 commit comments