fix: don't elide jsx pragma import namespaces (#11523)

* fix: don't elide jsx pragma import namespaces

* use the correct pragma oops
This commit is contained in:
Jason Quense 2020-05-14 10:01:54 -04:00 committed by GitHub
parent 9a52019019
commit de8264c8a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -169,6 +169,11 @@ export default declare(
}
}
let pragmaImportName = fileJsxPragma || jsxPragma;
if (pragmaImportName) {
[pragmaImportName] = pragmaImportName.split(".");
}
// remove type imports
for (let stmt of path.get("body")) {
if (t.isImportDeclaration(stmt)) {
@ -203,7 +208,7 @@ export default declare(
isImportTypeOnly({
binding,
programPath: path,
jsxPragma: fileJsxPragma || jsxPragma,
jsxPragma: pragmaImportName,
})
) {
importsToRemove.push(binding.path);

View File

@ -0,0 +1,4 @@
/* @jsx jsx.htm */
// Don't elide htm if a JSX element appears somewhere.
import * as jsx from "fake-jsx-package";
<div></div>;

View File

@ -0,0 +1,3 @@
{
"plugins": [["transform-typescript", { "isTSX": true }]]
}

View File

@ -0,0 +1,4 @@
/* @jsx jsx.htm */
// Don't elide htm if a JSX element appears somewhere.
import * as jsx from "fake-jsx-package";
<div></div>;