Skip to content

Commit d2bf50c

Browse files
committed
Give the user a warning when using unoptimized JSX code and send the user to the correct location in the documentation to optimize.
1 parent b1dd414 commit d2bf50c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/docs/08-tooling-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ We provide CDN-hosted versions of React [on our download page](/react/downloads.
2020

2121
We have instructions for building from `master` [in our GitHub repository](https://github.com/facebook/react). We build a tree of CommonJS modules under `build/modules` which you can drop into any environment or packaging tool that supports CommonJS.
2222

23-
## JSX
23+
## <a id="jsx">JSX</a>
2424

2525
### In-browser JSX Transform
2626

vendor/browser-transforms.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var load = exports.load = function(url, callback) {
5151
var xhr;
5252
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
5353
: new XMLHttpRequest();
54+
5455
// Disable async since we need to execute scripts in the order they are in the
5556
// DOM to mirror normal script loading.
5657
xhr.open('GET', url, false);
@@ -79,6 +80,10 @@ runScripts = function() {
7980
return script.type === 'text/jsx';
8081
});
8182

83+
if(jsxScripts.length){
84+
console.warn("You are using unoptimized JSX (to optimize for production see: http://facebook.github.io/react/docs/tooling-integration.html#jsx)");
85+
}
86+
8287
jsxScripts.forEach(function(script) {
8388
if (script.src) {
8489
load(script.src);

0 commit comments

Comments
 (0)