Files
ClassContent/历届学生/17届课程/myshop_app/shop_fontend/vue.config.js
2024-09-27 02:06:13 +08:00

55 lines
1.2 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')
module.exports = {
publicPath: './',
lintOnSave: false,
productionSourceMap: false,
devServer: {
// proxy: {
// '/api': {
// target: 'https://api.jisuapi.com/weather',
// changeOrigin: true,
// ws: true,
// pathRewrite: {
// '^/api': ''
// }
// }
// },
port: 1314,
compress: true,
open: true
},
chainWebpack: config => {
// 去除 preload 和 prefetch减少页面请求次数
config.plugins.delete('preload')
config.plugins.delete('prefetch')
// 配置路径别名
config.resolve.alias
.set('@', resolve('src'))
.set('!', resolve('src/assets/styl/page'))
// 配置css的全局自动导入
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)))
},
};
function addStyleResource (rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/assets/styl/imports.styl'),
],
})
}
function resolve (dir) {
return path.join(__dirname, dir)
}