Skip to content

Commit b28d2b2

Browse files
authored
fix: exclude transform-typescript when present (#1265)
1 parent 1b71dcf commit b28d2b2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/funny-clubs-see.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
Let SWC handle `transform-typescript` when using `babel-swc-loader`

packages/repack/src/loaders/babelSwcLoader/swc.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const SWC_SUPPORTED_CUSTOM_RULES = new Set([
4141
'transform-react-jsx',
4242
'transform-modules-commonjs',
4343
'proposal-export-default-from',
44+
'transform-typescript',
4445
'transform-dynamic-import',
4546
]);
4647

@@ -241,6 +242,13 @@ function getTransformForOfConfig(
241242
};
242243
}
243244

245+
function getTransformTypescriptConfig(
246+
swcConfig: SwcLoaderOptions
247+
): SwcLoaderOptions {
248+
// passthrough
249+
return swcConfig;
250+
}
251+
244252
const SWC_SUPPORTED_CONFIGURABLE_RULES_MAP = {
245253
'transform-class-properties': getTransformClassPropertiesConfig,
246254
'transform-private-methods': getTransformPrivateMethodsPropertyConfig,
@@ -261,6 +269,7 @@ const SWC_SUPPORTED_CUSTOM_RULES_MAP = {
261269
'transform-react-jsx-source': getTransformReactDevelopmentConfig,
262270
'transform-modules-commonjs': getTransformModulesCommonjsConfig,
263271
'proposal-export-default-from': getTransformExportDefaultFromConfig,
272+
'transform-typescript': getTransformTypescriptConfig,
264273
'transform-dynamic-import': getTransformDynamicImportConfig,
265274
};
266275

0 commit comments

Comments
 (0)