File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,14 @@ function compile(content, contentFilename) {
1919 var output = null ;
2020 var compilerHost = {
2121 getSourceFile : function ( filename , languageVersion ) {
22- var source , reactRegex ;
22+ var source ;
2323
24- // Accomodations for backslashes in Windows file paths.
25- if ( process . platform === 'win32' ) {
26- filename = filename . replace ( / \/ / g, '\\' ) ;
27- reactRegex = / \\ (?: R e a c t | R e a c t D O M ) (?: \. d ) ? \. t s $ / ;
28- } else {
29- reactRegex = / \/ (?: R e a c t | R e a c t D O M ) (?: \. d ) ? \. t s $ / ;
30- }
24+ // `path.normalize` and `path.join` are used to turn forward slashes in
25+ // the file path into backslashes on Windows.
26+ filename = path . normalize ( filename ) ;
27+ var reactRegex = new RegExp (
28+ path . join ( '/' , '(?:React|ReactDOM)(?:\.d)?\.ts$' )
29+ ) ;
3130
3231 if ( filename === 'lib.d.ts' ) {
3332 source = fs . readFileSync (
You can’t perform that action at this time.
0 commit comments