Skip to content

Commit e612b6a

Browse files
authoredAug 15, 2023
fix(react-native): fix duplicate import (#894)
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.
1 parent 82928f0 commit e612b6a

File tree

1 file changed

+4
-1
lines changed
  • packages/babel-plugin-transform-react-native-svg/src

1 file changed

+4
-1
lines changed
 

‎packages/babel-plugin-transform-react-native-svg/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ const plugin = () => {
7979

8080
const importDeclarationVisitor = {
8181
ImportDeclaration(path: NodePath<t.ImportDeclaration>, state: State) {
82-
if (path.get('source').isStringLiteral({ value: 'react-native-svg' })) {
82+
if (
83+
path.get('source').isStringLiteral({ value: 'react-native-svg' }) &&
84+
!path.get('importKind').hasNode()
85+
) {
8386
state.replacedComponents.forEach((component) => {
8487
if (
8588
path

1 commit comments

Comments
 (1)

vercel[bot] commented on Aug 15, 2023

@vercel[bot]

Successfully deployed to the following URLs:

svgr – ./

svgr-git-main-gregberge.vercel.app
svgr-gregberge.vercel.app
api.react-svgr.com

Please sign in to comment.