diff --git a/src/babel/transformation/file/options.json b/src/babel/transformation/file/options.json
index 06f04ef7fe..f84f766c6b 100644
--- a/src/babel/transformation/file/options.json
+++ b/src/babel/transformation/file/options.json
@@ -83,6 +83,13 @@
"shorthand": "L"
},
+ "jsxPragma": {
+ "type": "string",
+ "description": "Custom pragma to use with JSX (same functionality as @jsx comments)",
+ "default": "React.createElement",
+ "shorthand": "P"
+ },
+
"ignore": {
"type": "list"
},
diff --git a/src/babel/transformation/transformers/other/react.js b/src/babel/transformation/transformers/other/react.js
index 2b098e5461..a729671dd3 100644
--- a/src/babel/transformation/transformers/other/react.js
+++ b/src/babel/transformation/transformers/other/react.js
@@ -4,7 +4,7 @@ import * as t from "../../../types";
var JSX_ANNOTATION_REGEX = /^\*\s*@jsx\s+([^\s]+)/;
export function Program(node, parent, scope, file) {
- var id = "React.createElement";
+ var id = file.opts.jsxPragma;
for (var i = 0; i < file.ast.comments.length; i++) {
var comment = file.ast.comments[i];
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/actual.js b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/actual.js
new file mode 100644
index 0000000000..acb0d0ca1b
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/actual.js
@@ -0,0 +1,8 @@
+/** @jsx dom */
+
+;
+
+var profile =
+

+
{[user.firstName, user.lastName].join(" ")}
+
;
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/expected.js b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/expected.js
new file mode 100644
index 0000000000..1febfa3188
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/expected.js
@@ -0,0 +1,14 @@
+/** @jsx dom */
+
+dom(Foo, null);
+
+var profile = dom(
+ "div",
+ null,
+ dom("img", { src: "avatar.png", className: "profile" }),
+ dom(
+ "h3",
+ null,
+ [user.firstName, user.lastName].join(" ")
+ )
+);
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json
new file mode 100644
index 0000000000..f06ff74164
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-comment-if-jsx-pragma-option-set/options.json
@@ -0,0 +1,3 @@
+{
+ "jsxPragma": "foo.bar"
+}
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/actual.js b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/actual.js
new file mode 100644
index 0000000000..5b144eb3ee
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/actual.js
@@ -0,0 +1,6 @@
+;
+
+var profile =
+

+
{[user.firstName, user.lastName].join(" ")}
+
;
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/expected.js b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/expected.js
new file mode 100644
index 0000000000..26eb142fac
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/expected.js
@@ -0,0 +1,12 @@
+dom(Foo, null);
+
+var profile = dom(
+ "div",
+ null,
+ dom("img", { src: "avatar.png", className: "profile" }),
+ dom(
+ "h3",
+ null,
+ [user.firstName, user.lastName].join(" ")
+ )
+);
diff --git a/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/options.json b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/options.json
new file mode 100644
index 0000000000..223d2362fc
--- /dev/null
+++ b/test/core/fixtures/transformation/react/honor-custom-jsx-pragma-option/options.json
@@ -0,0 +1,3 @@
+{
+ "jsxPragma": "dom"
+}