diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index c9f3214e22..ef40a3f5c7 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -2,8 +2,7 @@ import jsx from "@babel/plugin-syntax-jsx"; import helper from "@babel/helper-builder-react-jsx"; export default function({ types: t }, options) { - const { pragma } = options; - let id = pragma || "React.createElement"; + const pragma = options.pragma || "React.createElement"; const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; @@ -26,6 +25,7 @@ export default function({ types: t }, options) { visitor.Program = function(path, state) { const { file } = state; + let id = pragma; for (const comment of (file.ast.comments: Array)) { const matches = JSX_ANNOTATION_REGEX.exec(comment.value); if (matches) {