Vue.js 如何解脚本1003?

Vue.js 如何解脚本1003?,vue.js,internet-explorer,webpack,babeljs,Vue.js,Internet Explorer,Webpack,Babeljs,关于这个问题也有类似的问题,但似乎没有一个能真正解决这个问题 有一个VueJS项目,用ES6语法构建,用BabeJS传输,然后与Webpack捆绑在一起 这里有一些规格 依赖项: "dependencies": { "@babel/core": "^7.6.2", "@babel/plugin-proposal-class-properties": "^7.5.0", "@babel/plugin-transform-modules-commonj

关于这个问题也有类似的问题,但似乎没有一个能真正解决这个问题

有一个VueJS项目,用ES6语法构建,用BabeJS传输,然后与Webpack捆绑在一起

这里有一些规格

依赖项:

"dependencies": {
        "@babel/core": "^7.6.2",
        "@babel/plugin-proposal-class-properties": "^7.5.0",
        "@babel/plugin-transform-modules-commonjs": "^7.5.0",
        "@babel/plugin-transform-shorthand-properties": "^7.2.0",
        "@babel/plugin-transform-runtime": "^7.6.2",
        "@babel/preset-env": "^7.6.2",
        "@babel/runtime": "^7.6.2",
        "@vue/test-utils": "^1.0.0-beta.29",
        "autoprefixer": "^9.6.1",
        "babel-eslint": "^10.0.1",
        "babel-jest": "^24.8.0",
        "babel-loader": "^8.0.6",
        "babel-plugin-istanbul": "^5.1.0",
        "babel-template": "^6.26.0",
        "chalk": "^2.4.2",
        "compression-webpack-plugin": "^3.0.0",
        "copy-webpack-plugin": "^5.0.3",
        "css-loader": "^2.1.0",
        "eslint": "^6.5.1",
        "eslint-friendly-formatter": "^4.0.1",
        "eslint-loader": "^2.2.1",
        "eslint-plugin-vue": "^5.1.0",
        "friendly-errors-webpack-plugin": "^1.7.0",
        "html-webpack-plugin": "^3.2.0",
        "jest": "^24.8.0",
        "jest-serializer-vue": "^2.0.2",
        "js-yaml": "^3.12.1",
        "jsdom": "^13.2.0",
        "lint-staged": "^9.4.1",
        "mini-css-extract-plugin": "^0.7.0",
        "node-env-tools": "^1.0.2",
        "node-sass": "^4.12.0",
        "optimize-css-assets-webpack-plugin": "^5.0.3",
        "ora": "^3.4.0",
        "portfinder": "^1.0.20",
        "postcss": "^7.0.17",
        "postcss-assets": "^5.0.0",
        "postcss-import": "^12.0.1",
        "postcss-loader": "^3.0.0",
        "postcss-url": "^8.0.0",
        "prettier": "^1.16.4",
        "pug": "^2.0.4",
        "pug-plain-loader": "^1.0.0",
        "rimraf": "^2.6.3",
        "sass-lint": "^1.12.1",
        "sass-loader": "^7.1.0",
        "semver": "^5.6.0",
        "style-loader": "^0.23.1",
        "terser-webpack-plugin": "^1.3.0",
        "text-table": "^0.2.0",
        "url-loader": "^2.0.1",
        "vue": "^2.6.10",
        "vue-eslint-parser": "^6.0.4",
        "vue-jest": "^3.0.4",
        "vue-loader": "^15.7.0",
        "vue-prop-sep": "^1.0.2",
        "vue-router": "^3.0.2",
        "vue-server-renderer": "^2.6.10",
        "vue-style-loader": "^4.1.2",
        "vue-template-compiler": "^2.6.10",
        "vue-template-es2015-compiler": "^1.9.1",
        "webpack": "^4.41.0",
        "webpack-bundle-analyzer": "^3.5.1",
        "webpack-cli": "^3.3.5",
        "webpack-dev-server": "^3.7.2",
        "webpack-merge": "^4.2.1"
    }
法律改革委员会:

{
    "env": {
        "test": {
            "plugins": [
                "istanbul"
            ]
        }
    },
    "presets": [
        [
            "@babel/preset-env",
            {
                "debug": true,
                "modules": false,
                "targets": {
                    "browsers": ["> 1%", "last 2 versions", "not ie <= 10"]
                }
            }
        ]
    ],
    "plugins": [
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-transform-modules-commonjs",
        "@babel/plugin-transform-shorthand-properties",
        "@babel/plugin-transform-runtime"
    ]
}
测试浏览器配置,在这里,它应该在IE11上工作,但它没有

此外,在项目中还使用了引导vue

在我看来,虽然巴贝尔使用的是正确的浏览器列表配置,但在某些情况下,并没有正确地使用它,也许webpack正在覆盖配置

有什么建议吗? 提前谢谢

更新

我已经更改了@babel/preset env配置并添加了
core js

调试跟踪此输出:

Using targets:
{
  "android": "76",
  "chrome": "76",
  "edge": "17",
  "firefox": "68",
  "ie": "10",
  "ios": "12.2",
  "opera": "12.1",
  "safari": "12.1",
  "samsung": "9.2"
}

Using modules transform: auto

Using plugins:
  transform-template-literals { "android":"76", "ie":"10", "ios":"12.2", "opera":"12.1", "safari":"12.1" }
  transform-literals { "android":"76", "ie":"10", "opera":"12.1" }
  transform-function-name { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  transform-arrow-functions { "android":"76", "ie":"10", "opera":"12.1" }
  transform-block-scoped-functions { "android":"76", "ie":"10", "opera":"12.1" }
  transform-classes { "android":"76", "ie":"10", "opera":"12.1" }
  transform-object-super { "android":"76", "ie":"10", "opera":"12.1" }
  transform-shorthand-properties { "android":"76", "ie":"10", "opera":"12.1" }
  transform-duplicate-keys { "android":"76", "ie":"10", "opera":"12.1" }
  transform-computed-properties { "android":"76", "ie":"10", "opera":"12.1" }
  transform-for-of { "android":"76", "ie":"10", "opera":"12.1" }
  transform-sticky-regex { "android":"76", "ie":"10", "opera":"12.1" }
  transform-dotall-regex { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  transform-unicode-regex { "android":"76", "ie":"10", "opera":"12.1" }
  transform-spread { "android":"76", "ie":"10", "opera":"12.1" }
  transform-parameters { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  transform-destructuring { "android":"76", "ie":"10", "opera":"12.1" }
  transform-block-scoping { "android":"76", "ie":"10", "opera":"12.1" }
  transform-typeof-symbol { "android":"76", "ie":"10", "opera":"12.1" }
  transform-new-target { "android":"76", "ie":"10", "opera":"12.1" }
  transform-regenerator { "android":"76", "ie":"10", "opera":"12.1" }
  transform-exponentiation-operator { "android":"76", "ie":"10", "opera":"12.1" }
  proposal-async-generator-functions { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  proposal-object-rest-spread { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  proposal-unicode-property-regex { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1", "samsung":"9.2" }
  proposal-json-strings { "android":"76", "edge":"17", "ie":"10", "opera":"12.1", "samsung":"9.2" }
  proposal-optional-catch-binding { "android":"76", "edge":"17", "ie":"10", "opera":"12.1", "samsung":"9.2" }
  transform-named-capturing-groups-regex { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1", "samsung":"9.2" }
  syntax-dynamic-import { "android":"76", "chrome":"76", "edge":"17", "firefox":"68", "ie":"10", "ios":"12.2", "opera":"12.1", "safari":"12.1", "samsung":"9.2" }

Using polyfills with `usage` option:

  When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed.
  Please remove the direct import of `core-js` or use `useBuiltIns: 'entry'` instead.

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/index.js] Based on your code and targets, core-js polyfills were not added.
12% building 19/25 modules 6 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/html-entities/index.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/router.js] Based on your code and targets, core-js polyfills were not added.
12% building 21/27 modules 6 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/loglevel/lib/loglevel.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/plugins/env-config.js] Based on your code and targets, core-js polyfills were not added.
40% building 223/249 modules 26 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/product-selection/script.js] Added following core-js polyfills:
  es.array.find { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.includes { "android":"76", "ie":"10", "opera":"12.1" }
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  es.string.includes { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/product-selection/script.js] Based on your code and targets, added regenerator-runtime.
40% building 224/249 modules 25 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/app/script.js] Based on your code and targets, core-js polyfills were not added.
40% building 225/249 modules 24 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/product-confirmation/script.js] Based on your code and targets, core-js polyfills were not added.
40% building 226/249 modules 23 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/sms-confirmation/script.js] Based on your code and targets, core-js polyfills were not added.
40% building 227/249 modules 22 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/home/script.js] Based on your code and targets, core-js polyfills were not added.
40% building 228/249 modules 21 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/process-check/script.js] Added following core-js polyfills:
  es.array.concat { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.includes { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.some { "opera":"12.1" }
  es.object.keys { "android":"76", "ie":"10", "opera":"12.1" }
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  es.regexp.exec { "opera":"12.1" }
  es.string.includes { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  es.string.replace { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "ios":"12.2", "opera":"12.1", "safari":"12.1" }
  es.string.split { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/process-check/script.js] Based on your code and targets, added regenerator-runtime.
40% building 229/249 modules 20 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/toast/toaster.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/entities/script.js] Added following core-js polyfills:
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/entities/script.js] Based on your code and targets, added regenerator-runtime.
40% building 237/252 modules 15 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/vue-functional-data-merge/dist/lib.esm.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/entity-login/script.js] Added following core-js polyfills:
  es.array.concat { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.for-each { "opera":"12.1" }
  es.array.includes { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.join { "ie":"10", "opera":"12.1" }
  es.array.last-index-of { "android":"76", "opera":"12.1" }
  es.array.map { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.some { "opera":"12.1" }
  es.date.to-string { "opera":"12.1" }
  es.function.name { "ie":"10", "opera":"12.1" }
  es.object.assign { "android":"76", "ie":"10", "opera":"12.1" }
  es.object.keys { "android":"76", "ie":"10", "opera":"12.1" }
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  es.regexp.exec { "opera":"12.1" }
  es.regexp.to-string { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  es.string.includes { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }
  es.string.replace { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "ios":"12.2", "opera":"12.1", "safari":"12.1" }
  web.dom-collections.for-each { "android":"76", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/views/entity-login/script.js] Based on your code and targets, added regenerator-runtime.
46% building 303/321 modules 18 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/tooltip/helpers/bv-popper.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/robots.js] Added following core-js polyfills:
  es.array.filter { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.find { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.includes { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.index-of { "android":"76", "opera":"12.1" }
  es.array.sort { "android":"76", "opera":"12.1" }
  es.function.name { "ie":"10", "opera":"12.1" }
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  es.string.includes { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/robots.js] Based on your code and targets, added regenerator-runtime.
46% building 304/321 modules 17 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/tooltip/helpers/bv-popper.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/is-error.js] Added following core-js polyfill:
  es.array.concat { "android":"76", "ie":"10", "opera":"12.1" }
46% building 305/321 modules 16 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/bootstrap-vue/esm/components/tooltip/helpers/bv-popper.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/eur-codes.js] Added following core-js polyfills:
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }
  es.regexp.exec { "opera":"12.1" }
  es.string.match { "android":"76", "edge":"17", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/eur-codes.js] Based on your code and targets, added regenerator-runtime.
46% building 307/334 modules 27 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/modules/es.regexp.to-string.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/delayed-request.js] Added following core-js polyfills:
  es.object.to-string { "android":"76", "ie":"10", "opera":"12.1" }
  es.promise { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "opera":"12.1" }

[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/delayed-request.js] Based on your code and targets, added regenerator-runtime.
63% building 451/503 modules 52 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/array-species-create.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/accounts-list/script.js] Based on your code and targets, core-js polyfills were not added.
64% building 453/503 modules 50 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/array-species-create.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/app-footer/script.js] Based on your code and targets, core-js polyfills were not added.
64% building 455/503 modules 48 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/array-species-create.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/app-header/script.js] Based on your code and targets, core-js polyfills were not added.
64% building 456/503 modules 47 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/array-species-create.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/entity-logo/script.js] Based on your code and targets, core-js polyfills were not added.
64% building 457/503 modules 46 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/array-species-create.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/account-detail/script.js] Based on your code and targets, core-js polyfills were not added.
67% building 523/544 modules 21 active /home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/node_modules/core-js/internals/create-property-descriptor.js
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/mixins/app-close.js] Added following core-js polyfills:
  es.array.concat { "android":"76", "ie":"10", "opera":"12.1" }
  es.array.join { "ie":"10", "opera":"12.1" }
  es.array.map { "android":"76", "ie":"10", "opera":"12.1" }
  es.object.keys { "android":"76", "ie":"10", "opera":"12.1" }
  es.regexp.exec { "opera":"12.1" }
  es.string.replace { "android":"76", "edge":"17", "firefox":"68", "ie":"10", "ios":"12.2", "opera":"12.1", "safari":"12.1" }
68% building 551/567 modules 16 active ...its/cobranding/webportal-2.0/node_modules/sass-loader/dist/cjs.js??ref--4-3!/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/accounts-list-item/style.sass?vue&type=style&index=0&lang=sass&
[/home/arturom/Projects/com.gitlab/eurobits/cobranding/webportal-2.0/src/components/accounts-list-item/script.js] Added following core-js polyfill:
  es.number.constructor { "android":"76", "ie":"10", "opera":"12.1" }
98% after emitting CopyPlugin

更新(2019-11-26)

这是我现在的
.babelrc
配置:

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "debug": true,
                "modules": false,
                "useBuiltIns": "entry",
                "corejs": 3,
                "targets": {
                    "browsers": "> 1%, last 2 versions, not ie <= 10"
                }
            }
        ]
    ]
}
{
“预设”:[
[
“@babel/preset env”,
{
“调试”:正确,
“模块”:错误,
“useBuiltIns”:“条目”,
“corejs”:3,
“目标”:{

“浏览器”:">1%,上两个版本,不是ie。你能调试你的代码并找出引起此错误的代码部分或语法类型吗?在使用网页包之前,应用程序在ie浏览器中是否运行良好?此外,由于你使用的是ES6语法,通常,我们可以尝试使用将这部分代码翻译为ES5或尝试安装“babel/polyfill”。然后,使用useBuiltIns:“entry”,然后将import“@babel/polyfill”添加到您的输入文件中。@ZhiLv MSFT脚本1003问题与对象中的缩写sintax有关,即:
var a=1;var b={a}
。正如您在
依赖项中看到的,我已经在使用Babel和
@Babel/preset env
@Babel/polyfill
被弃用,建议使用
核心js
,我已经尝试过了,但它仍然不能很好地转换输出。关于这段代码
var a=1;var b={a};
,您可以自己将其更改为
var a=1;var b={a:a};
。由于IE浏览器不支持ES6语法,请尝试配置为使用ES5语法构建/运行应用程序。您可以引用或。此外,请检查package.json,确保它包含IE11浏览器支持,如下所示:
{“targets”:{“chrome”:“58”,“ie”:“11”}
@ZhiLv MSFT所以你的建议是自己修复一些Babel应该自己翻译的东西…你可能已经解决了这个问题,因为这是很久以前的事了,但我只是遇到了同样的问题,发现这与网页包中的优化步骤有关,在缩小时没有考虑es5(因此将长格式对象语法缩短为速记)。我必须设置
terserOptions:{ecma:5,},
在我的优化配置中解决此问题。您是否可以调试代码并找到导致此错误的代码部分或语法类型?在使用网页包之前,应用程序是否在IE浏览器中运行良好?此外,由于您使用的是ES6语法,通常,我们可以尝试使用或者尝试安装“babel/polyfill”。然后,使用内置的:“entry”,然后将import“@babel/polyfill”添加到您的输入文件中。@ZhiLv MSFT脚本1003问题与对象中的速记sintax有关,即:
var a=1;var b={a}
。正如您在
依赖项中看到的,我已经在使用Babel和
@Babel/preset env
@Babel/polyfill
被弃用,建议使用
核心js
,我已经尝试过了,但它仍然不能很好地转换输出。关于这段代码
var a=1;var b={a};
,您可以自己将其更改为
var a=1;var b={a:a};
。由于IE浏览器不支持ES6语法,请尝试配置为使用ES5语法构建/运行应用程序。您可以引用或。此外,请检查package.json,确保它包含IE11浏览器支持,如下所示:
{“targets”:{“chrome”:“58”,“ie”:“11”}
@ZhiLv MSFT所以你的建议是自己修复一些Babel应该自己翻译的东西…你可能已经解决了这个问题,因为这是很久以前的事了,但我只是遇到了同样的问题,发现这与网页包中的优化步骤有关,在缩小时没有考虑es5(因此将长格式对象语法缩短为速记)。我必须在优化配置中设置
terserOptions:{ecma:5,},
,才能解决这个问题。
{
    "presets": [
        [
            "@babel/preset-env",
            {
                "debug": true,
                "modules": false,
                "useBuiltIns": "entry",
                "corejs": 3,
                "targets": {
                    "browsers": "> 1%, last 2 versions, not ie <= 10"
                }
            }
        ]
    ]
}