代码之家  ›  专栏  ›  技术社区  ›  darksoulsong

静态反应:承诺在IE11上未定义

  •  0
  • darksoulsong  · 技术社区  · 7 年前

    在这个 react-static 我正在编写应用程序,我注意到上述错误仅发生在IE11及以下版本上。它发生在我的一些项目依赖项上,而不是我自己编写的代码上(我正在用它填充整个应用程序) @babel/polyfill

    这让我觉得我应该 @巴别塔/聚填充 依赖关系也是,对吗?如果是,我该怎么做?

    babelrc 文件:

    {  
      "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"]
        }
      }
    }
    

    我的 package.json 文件:

    {
      "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"
      }
    }
    
    0 回复  |  直到 6 年前