1,package.json中script选项作用
{
"name": "demo",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "nuxt start",
"generate--dev": "BASE_URL='https://dev.yygongzi.com' nuxt generate",
"generate--demo": "BASE_URL='https://demo.yygongzi.com' nuxt generate",
"generate": "BASE_URL='https://www.yygongzi.com' nuxt generate"
},
"dependencies": {
"@nuxtjs/axios": "^5.4.1",
"axios": "^0.19.0",
"cross-env": "^5.2.0",
"element-ui": "^2.4.11",
"koa": "^2.6.2",
"md5": "^2.2.1",
"msgpack-lite": "^0.1.26",
"nuxt": "^2.4.0"
},
"devDependencies": {
"nodemon": "^1.18.9",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2"
}
}
上述配置npm run generate
会执行 BASE_URL='https://www.yygongzi.com' nuxt generate
npm run 如果不加任何参数,默认会列出package.json中所有可以执行的脚本命令。
npm 内置了两个命令 npm test
: npm run test; npm start
:npm run start。
网友评论