Skip to content

Commit 81ed502

Browse files
committed
fix!: Ensure babel only transforms files that match the full extension
1 parent fcb9672 commit 81ed502

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: index.js

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

3+
var endsInJsx = /\.jsx$/;
34
var endsInTs = /\.ts$/;
45
var endsInTsx = /\.tsx$/;
5-
var endsInBabelJs = /\.babel\.[jt]s(x)$/;
6+
var endsInBabelJs = /\.babel\.js$/;
7+
var endsInBabelTs = /\.babel\.ts$/;
68
var endsInEsbuildJs = /\.esbuild\.js$/;
79
var endsInEsbuildJsx = /\.esbuild\.jsx$/;
810
var endsInEsbuildTs = /\.esbuild\.ts$/;
@@ -23,7 +25,7 @@ var extensions = {
2325
hook({
2426
extensions: '.js',
2527
rootMode: 'upward-optional',
26-
ignore: [ignoreNonBabelAndNodeModules],
28+
overrides: [{ only: [endsInBabelJs] }],
2729
});
2830
},
2931
},
@@ -62,7 +64,7 @@ var extensions = {
6264
hook({
6365
extensions: '.ts',
6466
rootMode: 'upward-optional',
65-
ignore: [ignoreNonBabelAndNodeModules],
67+
overrides: [{ only: [endsInBabelTs] }],
6668
});
6769
},
6870
},
@@ -145,7 +147,7 @@ var extensions = {
145147
hook({
146148
extensions: '.jsx',
147149
rootMode: 'upward-optional',
148-
ignore: [ignoreNonBabelAndNodeModules],
150+
overrides: [{ only: [endsInJsx] }],
149151
});
150152
},
151153
},
@@ -206,7 +208,7 @@ var extensions = {
206208
hook({
207209
extensions: '.ts',
208210
rootMode: 'upward-optional',
209-
ignore: [ignoreNonBabelAndNodeModules],
211+
overrides: [{ only: [endsInTs] }],
210212
});
211213
},
212214
},
@@ -233,7 +235,7 @@ var extensions = {
233235
hook({
234236
extensions: '.tsx',
235237
rootMode: 'upward-optional',
236-
ignore: [ignoreNonBabelAndNodeModules],
238+
overrides: [{ only: [endsInTsx] }],
237239
});
238240
},
239241
},

0 commit comments

Comments
 (0)