mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
This disables symbol renaming in production builds. The original variable and function names are preserved. All other forms of compression applied by Closure (dead code elimination, inlining, etc) are unchanged — the final program is identical to what we were producing before, just in a more readable form. The motivation is to make it easier to debug React issues that only occur in production — the same reason we decided to start shipping sourcemaps in #28827 and #28827. However, because most apps run their own minification step on their npm dependencies, it's not necessary for us to minify the symbols before publishing — it'll be handled the app, if desired. This is the same strategy Meta has used to ship React for years. The React build itself has unminified symbols, but they get minified as part of Meta's regular build pipeline. Even if an app does not minify their npm dependencies, gzip covers most of the cost of symbol renaming anyway. This saves us from having to ship sourcemaps, which means even apps that don't have sourcemaps configured will be able to debug the React build as easily as they would any other npm dependency.
8 lines
194 B
JavaScript
8 lines
194 B
JavaScript
'use strict';
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
module.exports = require('./cjs/scheduler.production.js');
|
|
} else {
|
|
module.exports = require('./cjs/scheduler.development.js');
|
|
}
|