From 765e920e481ca0e856fd18669578989f38e631d6 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Thu, 19 Oct 2017 16:09:56 -0700 Subject: [PATCH] Fix regression that leaks JSX pragma config between files. (#6519) --- packages/babel-plugin-transform-react-jsx/src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {