Skip to content

Commit 5680b3f

Browse files
committed
fix: Ensure esbuild-register only applies to ts or tsx files
1 parent 2e00a6e commit 5680b3f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: index.js

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
var path = require('path');
22

3+
var endsInTs = /\.ts$/;
4+
var endsInTsx = /\.tsx$/;
35
var endsInBabelJs = /\.babel\.[jt]s(x)$/;
46

57
var mjsStub = path.join(__dirname, 'mjs-stub');
@@ -162,6 +164,9 @@ var extensions = {
162164
mod.register({
163165
extensions: ['.ts'],
164166
target: 'node' + process.version.slice(1),
167+
hookMatcher: function(file) {
168+
return endsInTs.test(file);
169+
},
165170
});
166171
},
167172
},
@@ -186,6 +191,9 @@ var extensions = {
186191
mod.register({
187192
extensions: ['.tsx'],
188193
target: 'node' + process.version.slice(1),
194+
hookMatcher: function(file) {
195+
return endsInTsx.test(file);
196+
},
189197
});
190198
},
191199
},

0 commit comments

Comments
 (0)