JavaScript compiler: Babel 发表于 2019-11-13 更新于 2021-07-02 阅读次数: Disqus: 资源 babel core-js cross-env .babelrc babel config file options babel安装 1npm i -D @babel/core @babel/preset-env @babel/cli .babelrc 1234567891011121314151617{ "env": { "production": { "presets": [ [ "@babel/preset-env", { "modules": false } ] ] } }, "ignore": [ "node_modules/**" ]} 安装 cross-env 1npm i -D cross-env package.json 123456{ "scripts": { "build": "rollup --config", "build:prod": "cross-env BABEL_ENV=production npm run build" }} Polyfill: core-js安装 1npm i -D core-js@3 .babelrc 12345678910111213141516171819{ "env": { "production": { "presets": [ [ "@babel/preset-env", { "modules": false, "useBuiltIns": "usage", "corejs": { "version": 3, "proposals": true } } ] ] } }} babel-jest bable-jest