Give the user a warning when using unoptimized JSX code and send the user to the correct location in the documentation to optimize.
SanderSpies committed
Sep 19, 2013 at 00:55 UTC
d2bf50c63d4390f4b73a65d6ec620e1ad842fa47
2 files changed
+6
-1
docs/docs/08-tooling-integration.md
+1
-1
@@ -20,7 +20,7 @@ We provide CDN-hosted versions of React [on our download page](/react/downloads.
20
21
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.
22
23
-## JSX
23
+## <a id="jsx">JSX</a>
24
25
### In-browser JSX Transform
26
vendor/browser-transforms.js
+5
@@ -51,6 +51,7 @@ var load = exports.load = function(url, callback) {
51
var xhr;
52
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
53
: new XMLHttpRequest();
54
+
55
// Disable async since we need to execute scripts in the order they are in the
56
// DOM to mirror normal script loading.
57
xhr.open('GET', url, false);
@@ -79,6 +80,10 @@ runScripts = function() {
80
return script.type === 'text/jsx';
81
});
82
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
+
87
jsxScripts.forEach(function(script) {
88
if (script.src) {
89
load(script.src);