package.json
"scripts": {
"serve": "nodemon main.js --exec babel-node",
"start": "nodemon --exec babel-node main.js",
"build": "babel --out-dir dist",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"js-yaml": "^3.13.1",
"koa": "^2.11.0",
"koa-body": "^4.1.1",
"koa-bodyparser": "^4.3.0",
"koa-convert": "^1.2.0",
"koa-cors": "0.0.16",
"koa-logger": "^3.2.1",
"koa-onerror": "^4.1.0",
"koa-router": "^8.0.8",
"koa-session": "^6.0.0",
"mysql2": "^2.1.0",
"redis": "^3.0.2",
"sequelize": "^5.21.6",
"svg-captcha": "^1.4.0",
"validate.js": "^0.13.1"
},
"devDependencies": {
"@babel/cli": "^7.17.0",
"@babel/core": "^7.17.2",
"@babel/node": "^7.16.8",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.16.11",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"nodemon": "^2.0.15",
"regenerator-runtime": "^0.13.9"
}
babelrc文件
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
]
],
"plugins": ["@babel/plugin-transform-runtime"]
}
https://class.imooc.com/cours...
里面说@babel/node 和@babel/core 与nodemon 需要进行全局安装
最后一步需要配置vscode的配置文件,不过那个好像不配置也可以