Browse Source

build(js): Fix `react-refresh` babel plugin always loaded in d… (#17492)

This fixes the `react-refresh` babel plugin from always being loaded in prod. We only want it loading when `SENTRY_UI_HOT_RELOAD` exists. Otherwise this was causing runtime errors in development when using without env var.
Billy Vong 5 years ago
parent
commit
657322392f
1 changed files with 4 additions and 1 deletions
  1. 4 1
      babel.config.js

+ 4 - 1
babel.config.js

@@ -53,7 +53,10 @@ module.exports = {
           },
         ],
       ],
-      plugins: ['@babel/plugin-transform-react-jsx-source', 'react-refresh/babel'],
+      plugins: [
+        '@babel/plugin-transform-react-jsx-source',
+        !!process.env.SENTRY_UI_HOT_RELOAD ? 'react-refresh/babel' : null,
+      ].filter(Boolean),
     },
     test: {
       plugins: ['dynamic-import-node'],