From eed9ba103239306147b02ca98caa11f95e5a0968 Mon Sep 17 00:00:00 2001 From: Mohammad Kurjieh Date: Fri, 4 Aug 2023 05:53:16 +0300 Subject: [PATCH] fix: :bug: fixed duplicate react-native-svg duplicate import When updating the imports of react-native-svg there is no check on the importKind. This would cause a wrong update import and a crash in the cli. --- .../babel-plugin-transform-react-native-svg/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-react-native-svg/src/index.ts b/packages/babel-plugin-transform-react-native-svg/src/index.ts index 6c217b88..41cd4301 100644 --- a/packages/babel-plugin-transform-react-native-svg/src/index.ts +++ b/packages/babel-plugin-transform-react-native-svg/src/index.ts @@ -79,7 +79,10 @@ const plugin = () => { const importDeclarationVisitor = { ImportDeclaration(path: NodePath, state: State) { - if (path.get('source').isStringLiteral({ value: 'react-native-svg' })) { + if ( + path.get('source').isStringLiteral({ value: 'react-native-svg' }) && + !path.get('importKind').hasNode() + ) { state.replacedComponents.forEach((component) => { if ( path