uniapp 配置vue.config.js
uniapp是一套基于Vue语法的框架,同样也支持Vue.config.js配置
一般常用的莫过于路径的名称,可以省去繁琐的../../ 之类的,不但麻烦而且也不好维护
const path = require('path'); function resolve (dir) { return path.join(__dirname, dir) } module.exports = { chainWebpack: (config) => { config.resolve.alias .set('$css',resolve('/static/css')) .set('$common',resolve('/components')) .set('$api',resolve('/api')) .set('$page',resolve('/pages')) .set('$js',resolve('/static/js')); } };