Vue.js Vue Cli 4.4.6是否将ES2020纳入项目
如果我使用最新的vue Cli(当前版本为4.4.6)运行Vue.js Vue Cli 4.4.6是否将ES2020纳入项目,vue.js,ecmascript-next,vue-cli-4,ecmascript-2020,Vue.js,Ecmascript Next,Vue Cli 4,Ecmascript 2020,如果我使用最新的vue Cli(当前版本为4.4.6)运行vue create my new app,是否会实现所有新的ES2020功能?(我已经测试过“可选链接”,似乎能够使用它) 如果是这样的话,我如何从脚手架代码中分辨出来?我在babel.config.js中看到了@vue/cli插件babel/preset,这样做了吗 我相信ES2020已经正式完成。如果不正确,请告诉我。Babel插件确实允许编译ES2020功能。在运行生成之前,您可以通过启用debug查看正在使用的插件: //bab
vue create my new app
,是否会实现所有新的ES2020功能?(我已经测试过“可选链接”,似乎能够使用它)
如果是这样的话,我如何从脚手架代码中分辨出来?我在babel.config.js中看到了@vue/cli插件babel/preset
,这样做了吗
我相信ES2020已经正式完成。如果不正确,请告诉我。Babel插件确实允许编译ES2020功能。在运行生成之前,您可以通过启用
debug
查看正在使用的插件:
//babel.config.js
module.exports={
预设:[
//之前:
//“@vue/cli插件babel/preset”
['@vue/cli-plugin-babel/preset',{debug:true}]
]
}
调试输出如下所示:
⠇ Building for production...@babel/preset-env: `DEBUG` option
Using targets:
{
"android": "81",
"chrome": "80",
"edge": "18",
"firefox": "76",
"ie": "11",
"ios": "12.2",
"opera": "67",
"safari": "13",
"samsung": "10.1"
}
Using modules transform: false
Using plugins:
proposal-nullish-coalescing-operator { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-optional-chaining { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-json-strings { "edge":"18", "ie":"11" }
proposal-optional-catch-binding { "edge":"18", "ie":"11" }
transform-parameters { "ie":"11" }
proposal-async-generator-functions { "edge":"18", "ie":"11" }
proposal-object-rest-spread { "edge":"18", "ie":"11" }
transform-dotall-regex { "edge":"18", "firefox":"76", "ie":"11" }
proposal-unicode-property-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-named-capturing-groups-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-async-to-generator { "ie":"11" }
transform-exponentiation-operator { "ie":"11" }
transform-template-literals { "ie":"11", "ios":"12.2" }
transform-literals { "ie":"11" }
transform-function-name { "edge":"18", "ie":"11" }
transform-arrow-functions { "ie":"11" }
transform-classes { "ie":"11" }
transform-object-super { "ie":"11" }
transform-shorthand-properties { "ie":"11" }
transform-duplicate-keys { "ie":"11" }
transform-computed-properties { "ie":"11" }
transform-for-of { "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-unicode-escapes { "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-destructuring { "ie":"11" }
transform-block-scoping { "ie":"11" }
transform-typeof-symbol { "ie":"11" }
transform-new-target { "ie":"11" }
transform-regenerator { "ie":"11" }
syntax-dynamic-import { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
syntax-top-level-await { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
Using polyfills with `usage` option:
⠏ Building for production...
[/Users/tony/src/tmp/vue-tmp7/src/main.js] Based on your code and targets, core-js polyfills were not added.
⠴ Building for production...@babel/preset-env: `DEBUG` option
Using targets:
{
"android": "81",
"chrome": "80",
"edge": "18",
"firefox": "76",
"ie": "11",
"ios": "12.2",
"opera": "67",
"safari": "13",
"samsung": "10.1"
}
Using modules transform: false
Using plugins:
proposal-nullish-coalescing-operator { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-optional-chaining { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-json-strings { "edge":"18", "ie":"11" }
proposal-optional-catch-binding { "edge":"18", "ie":"11" }
transform-parameters { "ie":"11" }
proposal-async-generator-functions { "edge":"18", "ie":"11" }
proposal-object-rest-spread { "edge":"18", "ie":"11" }
transform-dotall-regex { "edge":"18", "firefox":"76", "ie":"11" }
proposal-unicode-property-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-named-capturing-groups-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-async-to-generator { "ie":"11" }
transform-exponentiation-operator { "ie":"11" }
transform-template-literals { "ie":"11", "ios":"12.2" }
transform-literals { "ie":"11" }
transform-function-name { "edge":"18", "ie":"11" }
transform-arrow-functions { "ie":"11" }
transform-classes { "ie":"11" }
transform-object-super { "ie":"11" }
transform-shorthand-properties { "ie":"11" }
transform-duplicate-keys { "ie":"11" }
transform-computed-properties { "ie":"11" }
transform-for-of { "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-unicode-escapes { "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-destructuring { "ie":"11" }
transform-block-scoping { "ie":"11" }
transform-typeof-symbol { "ie":"11" }
transform-new-target { "ie":"11" }
transform-regenerator { "ie":"11" }
syntax-dynamic-import { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
syntax-top-level-await { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
Using polyfills with `usage` option:
[/Users/tony/src/tmp/vue-tmp7/src/App.vue] Based on your code and targets, core-js polyfills were not added.
⠧ Building for production...
[/Users/tony/src/tmp/vue-tmp7/src/components/HelloWorld.vue] Based on your code and targets, core-js polyfills were not added.
在macOS Catalina上使用节点14、Vue CLI 4.4.6和@babel/preset env
7.10.3进行测试
自Vue CLI 4.4.6起支持的ES2020功能
Promise.prototype.allSettled
String.prototype.matchAll
BigInt
-可能需要ESLint配置