Skip to content

Commit 29f44d5

Browse files
committed
this is not what you are looking for.
When invoked through ES6 module, either by: ``` import {setCreateURLPatternCompilerFactory} from 'react-router-component'; setCreateURLPatternCompilerFactory() // <-- this is undefined/null ``` or by ``` import * as Router from 'react-router-component'; Router.setCreateURLPatternCompilerFactory(); // <-- this is `Router` the local copy ``` this of the setter is not module.exports.
1 parent 6eda559 commit 29f44d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var CaptureClicks = require('./lib/CaptureClicks');
1616

1717
var URLPattern = require('url-pattern');
1818

19-
module.exports = {
19+
var exportsObject = {
2020
Locations: Router.Locations,
2121
Pages: Router.Pages,
2222

@@ -42,6 +42,8 @@ module.exports = {
4242

4343
// For ES6 imports, which can't modify module.exports directly
4444
setCreateURLPatternCompilerFactory: function(fn) {
45-
this.createURLPatternCompiler = fn;
45+
exportsObject.createURLPatternCompiler = fn;
4646
}
4747
};
48+
49+
module.exports = exportsObject;

0 commit comments

Comments
 (0)