Give the user a warning when using unoptimized JSX code and send the user to the correct location in the documentation to optimize.
This commit is contained in:
parent
b1dd4149a0
commit
d2bf50c63d
|
@ -20,7 +20,7 @@ We provide CDN-hosted versions of React [on our download page](/react/downloads.
|
|||
|
||||
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.
|
||||
|
||||
## JSX
|
||||
## <a id="jsx">JSX</a>
|
||||
|
||||
### In-browser JSX Transform
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ var load = exports.load = function(url, callback) {
|
|||
var xhr;
|
||||
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
|
||||
: new XMLHttpRequest();
|
||||
|
||||
// Disable async since we need to execute scripts in the order they are in the
|
||||
// DOM to mirror normal script loading.
|
||||
xhr.open('GET', url, false);
|
||||
|
@ -79,6 +80,10 @@ runScripts = function() {
|
|||
return script.type === 'text/jsx';
|
||||
});
|
||||
|
||||
if(jsxScripts.length){
|
||||
console.warn("You are using unoptimized JSX (to optimize for production see: http://facebook.github.io/react/docs/tooling-integration.html#jsx)");
|
||||
}
|
||||
|
||||
jsxScripts.forEach(function(script) {
|
||||
if (script.src) {
|
||||
load(script.src);
|
||||
|
|
Loading…
Reference in New Issue