Skip to content

Commit f71c678

Browse files
committed
Use more precise React.createClass call regex to avoid matching own code
1 parent 4e863f5 commit f71c678

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module.exports = function (source) {
88
var matches = 0,
99
processedSource;
1010

11-
processedSource = source.replace(/React\.createClass/g, function (match) {
11+
processedSource = source.replace(/React\.createClass\s*\(\s*\{/g, function (match) {
1212
matches++;
13-
return '__hotUpdateAPI.createClass';
13+
return '__hotUpdateAPI.createClass({';
1414
});
1515

1616
if (!matches) {

0 commit comments

Comments
 (0)