Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
fix: adds check for use and better replace
Browse files Browse the repository at this point in the history
  • Loading branch information
jukben committed Apr 12, 2019
1 parent fef8be8 commit fe22c95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/babel/pbfied.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ const pbfiedPlugin = ({ types: t }) => {
},
JSXElement(path) {
if (path.node.openingElement.name.name === "defs") {
path.replaceWithMultiple(path.node.children.filter(t.isJSXElement));
// we gonna add them one after another, so we want to reverse the order to persist the order at the end
path.replaceInline(path.node.children.filter(t.isJSXElement));
}

if (path.node.openingElement.name.name === "use") {
if (t.isJSXIdentifier(path.node) && path.node.name.name === "use") {
path.remove();
}
},
Expand Down

0 comments on commit fe22c95

Please sign in to comment.