Skip to content

Commit

Permalink
fix: Ensure esbuild-register only applies to ts or tsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Apr 2, 2022
1 parent 2e00a6e commit 5680b3f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var path = require('path');

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

var mjsStub = path.join(__dirname, 'mjs-stub');
Expand Down Expand Up @@ -162,6 +164,9 @@ var extensions = {
mod.register({
extensions: ['.ts'],
target: 'node' + process.version.slice(1),
hookMatcher: function(file) {
return endsInTs.test(file);
},
});
},
},
Expand All @@ -186,6 +191,9 @@ var extensions = {
mod.register({
extensions: ['.tsx'],
target: 'node' + process.version.slice(1),
hookMatcher: function(file) {
return endsInTsx.test(file);
},
});
},
},
Expand Down

0 comments on commit 5680b3f

Please sign in to comment.