npm i @babel/core @babel/node @babel/preset-env nodemon -D
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": true
}
}
]
]
}
"scripts": {
"dev": "nodemon -w src --exec \"babel-node src/1.js\""
}
npm run dev
需要支持async await
npm i @babel/cli @babel/plugin-transform-runtime -D
npm i @babel/runtime @babel/runtime-corejs2
{
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 2
}
]
]
}
"scripts": {
"build": "babel src -d dist"
}
npm run build
{
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon -w src --exec \"babel-node src/1.js\"",
"build": "babel src -d dist"
},
"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/node": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"nodemon": "^1.18.11"
},
"dependencies": {
"@babel/runtime": "^7.4.3",
"@babel/runtime-corejs2": "^7.4.3"
}
}
{
"presets": [
[
"@babel/preset-env",
{
"corejs": 2
}
]
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}