mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
In React 19 React will finally stop publishing UMD builds. This is motivated primarily by the lack of use of UMD format and the added complexity of maintaining build infra for these releases. Additionally with ESM becoming more prevalent in browsers and services like esm.sh which can host React as an ESM module there are other options for doing script tag based react loading. This PR removes all the UMD build configs and forks. There are some fixtures that still have references to UMD builds however many of them already do not work (for instance they are using legacy features like ReactDOM.render) and rather than block the removal on these fixtures being brought up to date we'll just move forward and fix or removes fixtures as necessary in the future.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/* eslint-disable */
|
|
|
|
const NODE_ENV = process.env.NODE_ENV;
|
|
if (NODE_ENV !== 'development' && NODE_ENV !== 'production') {
|
|
throw new Error('NODE_ENV must either be set to development or production.');
|
|
}
|
|
global.__DEV__ = NODE_ENV === 'development';
|
|
global.__EXTENSION__ = false;
|
|
global.__TEST__ = NODE_ENV === 'test';
|
|
global.__PROFILE__ = NODE_ENV === 'development';
|
|
|
|
const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
|
|
|
|
// Default to running tests in experimental mode. If the release channel is
|
|
// set via an environment variable, then check if it's "experimental".
|
|
global.__EXPERIMENTAL__ =
|
|
typeof RELEASE_CHANNEL === 'string'
|
|
? RELEASE_CHANNEL === 'experimental'
|
|
: true;
|
|
|
|
global.__VARIANT__ = !!process.env.VARIANT;
|
|
|
|
if (typeof window !== 'undefined') {
|
|
global.requestIdleCallback = function (callback) {
|
|
return setTimeout(() => {
|
|
callback({
|
|
timeRemaining() {
|
|
return Infinity;
|
|
},
|
|
});
|
|
});
|
|
};
|
|
|
|
global.cancelIdleCallback = function (callbackID) {
|
|
clearTimeout(callbackID);
|
|
};
|
|
} else {
|
|
global.AbortController =
|
|
require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController;
|
|
}
|