showing results for - " 24refreshreg 24 is not defined"
Nicolas
24 Jul 2020
1hey this worked for me to handle this issue, follow this step by step
2
31.install cross-env
42.add cross-env NODE_ENV=production and cross-env NODE_ENV=development
53. follow this config 
6```
7const isDevPlugin = ['react-refresh/babel']
8
9const isProdPlugin = [
10  '@babel/plugin-transform-block-scoping',
11  'transform-remove-console',
12  'babel-plugin-transform-remove-undefined',
13  ['transform-react-remove-prop-types', { mode: 'wrap', ignoreFilenames: ['node_modules'] }]
14]
15
16const isProdDevPlugin = [
17  '@babel/plugin-transform-async-to-generator',
18  '@babel/plugin-syntax-dynamic-import',
19  ['@babel/plugin-proposal-class-properties', { loose: true }],
20  ['@babel/plugin-transform-runtime', { corejs: 3, useESModules: true }],
21  ['styled-jsx/babel', { optimizeForSpeed: true }]
22]
23
24const isPlugins = process.env.NODE_ENV !== 'production' ? isDevPlugin : isProdPlugin
25
26 {
27    test: /\.(js|jsx)$/,
28    use: [
29          {
30            loader: 'babel-loader',
31            options: {
32              cacheDirectory: true,
33              presets: [
34                [
35                  '@babel/preset-env',
36                  {
37                    useBuiltIns: 'usage',
38                    corejs: 3,
39                    loose: true,
40                    bugfixes: true,
41                    modules: false
42                  }
43                ],
44                ['@babel/preset-react', { useBuiltIns: true }]
45              ],
46              plugins: [...isProdDevPlugin, ...isPlugins]
47            }
48          }
49        ],
50        include: resolve(process.cwd(), 'src'),
51        exclude: /node_modules/
52  }
53```
54
55  4. enjoy working