vd/frontend/vue.config.js
2018-12-19 13:48:29 +08:00

35 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const path = require('path');
const resolve = dir => {
return path.join(__dirname, dir);
};
module.exports = {
outputDir: '../public',
indexPath: process.env.NODE_ENV === 'production' ? '../resources/views/index.blade.php' : 'index.html',
lintOnSave: true,
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义比如.set('@@', resolve('src/components'))
.set('src', resolve('src'))
.set('views', resolve('src/views'))
.set('api', resolve('src/api'))
.set('components', resolve('src/components'))
.set('mixins', resolve('src/mixins'))
.set('directives', resolve('src/directives'))
.set('assets', resolve('src/assets'))
.set('css', resolve('src/assets/css'))
.set('images', resolve('src/assets/images'))
.set('lib', resolve('src/assets/lib'))
.set('service', resolve('src/service'))
.set('util', resolve('src/service/util'))
.set('validate', resolve('src/service/validate'));
},
runtimeCompiler: true,
productionSourceMap: true
// 这里写你调用接口的基础路径来解决跨域如果设置了代理那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'localhost:3000'
// }
};