1、安装
npm install -g @vue/cli
2、安装命令
package.json
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
可以在shell执行编译
yarn run build
npm run build
可以在shell中开发模式运行
yarn run serve
npm run serve
3、webpack目录别名,链式调用
vue.config.js
const path = require('path');
function resolve (dir) {
return path.join(__dirname, dir)
}
module.exports = {
lintOnSave: true,
chainWebpack: (config)=>{
config.resolve.alias
.set('@', resolve('src'))
.set('_c',resolve('src/components'))
}
}
使用
import { matchEvery,hasOneOf } from '@/utils/tools'
import Bus from '_c/bus'
网友评论