Skip to content

Commit

Permalink
Merge pull request #12 from b12f/patch-1
Browse files Browse the repository at this point in the history
Add fix for breaking createElement name change
  • Loading branch information
luwanquan authored Jul 14, 2020
2 parents b78a91a + 11ab007 commit 774196f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/babel-sugar-inject-h.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ const autoImportH = (t, path) => {
const vcaImportNodes = importNodes.filter(p => p.source.value === importSource);
const hasH = vcaImportNodes.some(p => (
p.specifiers.some(s => (
t.isImportSpecifier(s) && s.imported.name === 'createElement' && s.local.name === 'h'
t.isImportSpecifier(s) && s.imported.name === 'h' && s.local.name === 'h'
))
));
if (!hasH) {
const vcaImportSpecifier = t.importSpecifier(t.identifier('h'), t.identifier('createElement'));
const vcaImportSpecifier = t.importSpecifier(t.identifier('h'), t.identifier('h'));
if (vcaImportNodes.length > 0) {
vcaImportNodes[0].specifiers.push(vcaImportSpecifier);
} else {
Expand Down

0 comments on commit 774196f

Please sign in to comment.