Skip to content

Commit

Permalink
fix(react-native): fix duplicate import (#894)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MohammadKurjieh authored Aug 15, 2023
1 parent 82928f0 commit e612b6a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ const plugin = () => {

const importDeclarationVisitor = {
ImportDeclaration(path: NodePath<t.ImportDeclaration>, 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
Expand Down

1 comment on commit e612b6a

@vercel
Copy link

@vercel vercel bot commented on e612b6a Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.