title: React App converting JS to ES5 to target IE 11
body: <p>I currently have a react app which is not running / rendering in IE, I think due to an ES5 / ES6 problem.</p>
  <p>The error I get is this: Syntax error.</p>
  <p>On the line highlighted below.</p>
  <pre><code>    if(process.env.NODE_ENV == 'production') {
  =&gt;       module.exports = require('./cjs/react.production.min.js');
      } else {
        module.exports = require('./cjs/react.development.js');
  </code></pre>
  <p>At the top of index.js prior to compilation:</p>
  <pre><code>import 'babel-polyfill'; 
  import 'react-app-polyfill/ie11';
  import 'react-app-polyfill/stable';
  </code></pre>
  <p>package.json:</p>
  <pre><code>{
    &quot;name&quot;: &quot;reactapp&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@babel/polyfill&quot;: &quot;^7.8.3&quot;,
      &quot;@material-ui/core&quot;: &quot;^3.9.3&quot;,
      &quot;@material-ui/icons&quot;: &quot;^3.0.2&quot;,
      &quot;@sentry/browser&quot;: &quot;^5.10.2&quot;,
      &quot;adblockdetect&quot;: &quot;0.0.2&quot;,
      &quot;animatewithsass&quot;: &quot;^3.2.1&quot;,
      &quot;axios&quot;: &quot;^0.18.1&quot;,
      &quot;babel-polyfill&quot;: &quot;^6.26.0&quot;,
      &quot;core-js&quot;: &quot;^3.6.5&quot;,
      &quot;date-fns&quot;: &quot;^2.10.0&quot;,
      &quot;detectrtc&quot;: &quot;^1.4.0&quot;,
      &quot;easy-peasy&quot;: &quot;^3.2.0&quot;,
      &quot;formik&quot;: &quot;^2.0.3&quot;,
      &quot;google-map-react&quot;: &quot;^1.1.5&quot;,
      &quot;js-cookie&quot;: &quot;^2.2.1&quot;,
      &quot;lodash&quot;: &quot;^4.17.15&quot;,
      &quot;material-design-icons&quot;: &quot;^3.0.1&quot;,
      &quot;material-icons&quot;: &quot;^0.3.1&quot;,
      &quot;node-sass&quot;: &quot;^4.13.0&quot;,
      &quot;platform&quot;: &quot;^1.3.5&quot;,
      &quot;query-string&quot;: &quot;^6.10.1&quot;,
      &quot;react&quot;: &quot;^16.11.0&quot;,
      &quot;react-albus&quot;: &quot;^2.0.0&quot;,
      &quot;react-app-polyfill&quot;: &quot;^1.0.6&quot;,
      &quot;react-color&quot;: &quot;^2.18.0&quot;,
      &quot;react-confirm-alert&quot;: &quot;^2.4.1&quot;,
      &quot;react-dom&quot;: &quot;^16.11.0&quot;,
      &quot;react-dropzone&quot;: &quot;^11.1.0&quot;,
      &quot;react-loader-spinner&quot;: &quot;^3.1.5&quot;,
      &quot;react-media-recorder&quot;: &quot;^1.2.0&quot;,
      &quot;react-paginate&quot;: &quot;^6.3.2&quot;,
      &quot;react-router-dom&quot;: &quot;^5.1.2&quot;,
      &quot;react-rtc-real&quot;: &quot;^1.11.22&quot;,
      &quot;react-scripts&quot;: &quot;2.1.8&quot;,
      &quot;react-select&quot;: &quot;^3.1.0&quot;,
      &quot;react-simple-line-icons&quot;: &quot;^1.0.8&quot;,
      &quot;react-spring&quot;: &quot;^8.0.27&quot;,
      &quot;react-stripe-elements&quot;: &quot;^5.1.0&quot;,
      &quot;react-stripe-script-loader&quot;: &quot;^1.0.16&quot;,
      &quot;react-switch&quot;: &quot;^5.0.1&quot;,
      &quot;react-toastify&quot;: &quot;^5.4.0&quot;,
      &quot;react-toggle&quot;: &quot;^4.1.1&quot;,
      &quot;react-tooltip&quot;: &quot;^3.11.2&quot;,
      &quot;regenerator-runtime&quot;: &quot;^0.13.5&quot;,
      &quot;semantic-ui-css&quot;: &quot;^2.4.1&quot;,
      &quot;semantic-ui-react&quot;: &quot;^0.88.2&quot;,
      &quot;styled-components&quot;: &quot;^4.4.1&quot;,
      &quot;sweetalert2-react&quot;: &quot;^0.8.3&quot;,
      &quot;videojs&quot;: &quot;^1.0.0&quot;,
      &quot;videojs-record&quot;: &quot;^4.0.0&quot;,
      &quot;webfontloader&quot;: &quot;^1.6.28&quot;,
      &quot;webrtc-adapter&quot;: &quot;^7.5.1&quot;,
      &quot;yup&quot;: &quot;^0.27.0&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;react-app-rewired start&quot;,
      &quot;build&quot;: &quot;set NODE_ENV=production &amp;&amp; react-app-rewired build&quot;,
      &quot;test&quot;: &quot;react-app-rewired test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: &quot;react-app&quot;
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;,
        &quot;IE 11&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;,
        &quot;IE 11&quot;
      ]
    },
    &quot;devDependencies&quot;: {
      &quot;animate-sass&quot;: &quot;^0.8.2&quot;,
      &quot;es-check&quot;: &quot;^5.1.1&quot;,
      &quot;react-app-rewired&quot;: &quot;^2.1.6&quot;
    }
  }
  </code></pre>
  <p>Inside .babelrc</p>
  <pre><code>{
      &quot;presets&quot;: [&quot;@babel/env&quot;,&quot;@babel/preset-react&quot;,[&quot;@babel/preset-env&quot;, { &quot;targets&quot;: &quot;defaults&quot; }]],
      &quot;plugins&quot; : [&quot;@babel/plugin-syntax-dynamic-import&quot;]
  }
  </code></pre>
  <p>Can anyone guide me in the right direction as to how to get babel to compile things properly for ES5? You'll notice here instead of ejecting, I'm using react-app-rewired, I don't think that should cause issues, so any help appreciated.</p>
  <p>Update:</p>
  <pre><code>&quot;Object doesn't support property or method 'repeat'&quot; - when running in development mode. How do I polyfill this? I think this may be the problem.  
  </code></pre>