@samitouri / QOS-React / commits / 29b1278790

[compiler] Check for __DEV__ for FastRefresh

We don't always have the NODE_ENV set, so additionally check for the __DEV__ global if it has one set. ghstack-source-id: 3719a4710a5fb1b4abf511f469c815917b7dfdf4 Pull Request resolved: https://github.com/facebook/react/pull/29785

Lauren Tan committed Jun 6, 2024 at 13:38 UTC 29b12787902acff714466e5eb656a7ab0f978836
1 file changed +4 -1
compiler/packages/babel-plugin-react-compiler/src/Babel/BabelPlugin.ts
+4 -1
@@ -30,13 +30,16 @@ export default function BabelPluginReactCompiler(
30 */
31 Program(prog, pass): void {
32 let opts = parsePluginOptions(pass.opts);
33 + const isDev =
34 + (typeof __DEV__ !== "undefined" && __DEV__ === true) ||
35 + process.env["NODE_ENV"] === "development";
36 if (
37 opts.enableReanimatedCheck === true &&
38 pipelineUsesReanimatedPlugin(pass.file.opts.plugins)
39 ) {
40 opts = injectReanimatedFlag(opts);
41 }
39 - if (process.env["NODE_ENV"] === "development") {
42 + if (isDev) {
43 opts = {
44 ...opts,
45 environment: {