vue.config.js
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//less全局配置
var path = require('path')
// const FileManagerPlugin = require('filemanager-webpack-plugin');
let Timestamp = new Date().getTime();
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
publicPath: './',
chainWebpack: (config) => {
//自定义路径 alias
config.resolve.alias
.set('@', resolve('src'))
.set('@api', resolve('src/api'))
.set('@mixins', resolve('src/mixins'))
.set('@store', resolve('src/store'))
.set('@libs', resolve('src/libs'))
.set('@router', resolve('src/router'))
.set('@components', resolve('src/components'))
},
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [path.resolve(__dirname, './src/assets/less/public-class.less'), ]
}
},
configureWebpack: { // webpack 配置,避免缓存js
output: { // 输出重构 打包编译后的 文件名称 【模块名称.版本号.时间戳】
filename: `js/[name].${Timestamp}.js`,
chunkFilename: `js/[name].${Timestamp}.js`
},
// plugins: [
// new FileManagerPlugin({ //初始化 filemanager-webpack-plugin 插件实例
// onEnd: {
// mkdir: ['./zip','./dist'], //初始化生产zip和dist文件夹
// archive: [ //然后我们选择dist文件夹将之打包成dist.zip并放在dist文件下
// {source: './dist', destination: './zip/dist.zip'},//吧./dist文件夹里的文件打包成dist.zip包放在zip文件夹内
// ]
// }
// })
// ]
},
devServer: {
host: "127.0.0.1",
port: 8006,
https: false,
hotOnly: false,
proxy: {
"/api": {
target: process.env.VUE_APP_api2,
changeOrigin: true,
pathRewrite: {
"^/api": "/",
},
},
}, // 设置代理
before: (app) => {
console.log(app);
},
},
}