The packaged code of vue-cli is still written in es6, and ie cannot be opened.

for example, after the project is packaged, the page cannot be opened in ie. After the uncompressed code is packaged, you can see that there is still let in the code. Why is babel not converted? no, no, no. The .babelrc code is as follows

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2",
    ["es2015"]
  ],
  "plugins": [
    "transform-vue-jsx",
    "transform-runtime",
    ["syntax-dynamic-import"],
    ["component", [
      {
        "libraryName": "element-ui",
        "styleLibraryName": "~theme"
      }
    ]]

  ],
  "env": {
    "test": {
      "presets": ["env", "stage-2"],
      "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
    }
  }
}
Feb.28,2021

if you read it correctly, you are configuring es6 . es2015 corresponds to es6 Oh


this is no problem,
clipboard.png

clipboard.png

in app.vue or other similar files, did you quote babel-polyfill ?


try adding transform-es2015-modules-umd to plugins.


have you solved it? Excuse me

Menu