4

In this react-static app I'm coding, I've noticed the aforementioned error is occurring on IE11 and below only. It's happening on some of my project's dependencies, and not on the code I wrote myself (and I'm pollyfilling the whole app with @babel/polyfill). So, I'm pretty convinced there's nothing is wrong on my part.

This makes me think I should @babel/polyfill the dependencies too, am I right? If so, how do I do this?

My .babelrc file:

{  
  "presets": [
    "react-static/babel-preset.js",
    ["@babel/preset-env", {
      "useBuiltIns": "entry",
      "debug": true,
      "targets": {
        "ie": "11"
      }
    }],
  ],
  "plugins": [
    "@babel/transform-runtime",
    "@babel/plugin-proposal-class-properties",
    "babel-plugin-styled-components",
    ["minify-dead-code-elimination", { "optimizeRawSize": true }],
    [
      "module-resolver",
      {
        "cwd": "babelrc",
        "root": ["./src/"],
        "extensions": [".jsx", ".js"],
        "alias": {
          "images": "./public/assets/images"
        }
      }
    ]
  ],
  "env": {
    "production": {
      "plugins": ["transform-remove-console"]
    },
    "development": {
      "plugins": ["@babel/transform-react-jsx-source"]
    }
  }
}

My package.json file:

{
  "name": "react-static-example-blank",
  "private": true,
  "license": "MIT",
  "scripts": {
    "start": "react-static start --debug --verbose",
    "stage": "react-static build --staging",
    "build": "react-static build",
    "serve": "serve dist -p 3001 -s"
  },
  "dependencies": {
    "react": "^16.6.3",
    "react-dom": "^16.6.3",
    "react-hot-loader": "^4.3.12",
    "react-static": "^6.0.18",
    "styled-components": "^4.1.3",
    "@fortawesome/fontawesome-svg-core": "^1.2.0-14",
    "@fortawesome/free-brands-svg-icons": "^5.1.0-11",
    "@fortawesome/free-solid-svg-icons": "^5.1.0-11",
    "@fortawesome/react-fontawesome": "^0.1.1",
    "@babel/polyfill": "^7.2.5",
    "core-js": "2.6.3"
  },
  "devDependencies": {
    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/runtime": "^7.0.0",
    "babel-eslint": "^9.0.0",
    "babel-plugin-minify-dead-code-elimination": "^0.4.3",
    "babel-plugin-module-resolver": "^3.1.1",
    "babel-plugin-styled-components": "^1.10.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^5.12.1",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-import-resolver-babel-module": "^5.0.1",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^6.2.0",
    "eslint-plugin-react": "^7.12.4",
    "eslint-config-react-tools": "1.1.6",
    "react-devtools": "^3.6.0",
    "serve": "^10.1.1"
  }
}
darksoulsong
  • 13,988
  • 14
  • 47
  • 90

0 Answers0