jazz
2023-12-13 d3f0ff6001c34c9ac37e9e776f090f5a696a1361
提交 | 用户 | age
3ac5f2 1 'use strict'
J 2 // Template version: 1.3.1
3 // see http://vuejs-templates.github.io/webpack for documentation.
4
5 const path = require('path')
aeb317 6 function resolve(dir) {
J 7   return path.join(__dirname, dir)
8 }
3ac5f2 9 module.exports = {
J 10   dev: {
11
12     // Paths
13     assetsSubDirectory: 'static',
14     assetsPublicPath: '/',
15     // 反向代理
16     proxyTable: {
17       '/api_local': { // 本地
18         target: 'http://192.168.31.69:8080',// 这个是你服务器开启的接口
19         changeOrigin: true,// 是否跨域
20         pathRewrite: {
21           '^/api_local': ''
22         }
23       },
24       '/api_test': { // 测试环境
aeb317 25         // target: 'http://192.168.31.69:8080',
878885 26         target: 'https://test6.phiskin.com/', // 导医
1d1095 27         // target: 'https://serv3.phiskin.com/', // 导医线上
6da3c1 28         // target: 'https://test6.phiskin.com/phi_appt/', // 新预约phis后台
3ac5f2 29         // target: 'http://hymctest.huoxiongit.com/',// 这个是你服务器开启的接口
1d1095 30         changeOrigin: true, // 是否跨域
3ac5f2 31         pathRewrite: {
J 32           '^/api_test': ''
33         }
34       }
35     },
36
37     // Various Dev Server settings
38     host: '0.0.0.0', // can be overwritten by process.env.HOST
39     port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
40     autoOpenBrowser: false,
41     errorOverlay: true,
42     notifyOnErrors: true,
43     poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
44
45     
46     /**
47      * Source Maps
48      */
49
50     // https://webpack.js.org/configuration/devtool/#development
51     devtool: 'cheap-module-eval-source-map',
52
53     // If you have problems debugging vue-files in devtools,
54     // set this to false - it *may* help
55     // https://vue-loader.vuejs.org/en/options.html#cachebusting
56     cacheBusting: true,
57
58     cssSourceMap: true
59   },
60
61   build: {
62     // Template for index.html
63     index: path.resolve(__dirname, '../dist/index.html'),
64
65     // Paths
66     assetsRoot: path.resolve(__dirname, '../dist'),
67     assetsSubDirectory: 'static',
68     assetsPublicPath: './',
69     // assetsPublicPath: 'https://miji20.oss-cn-shenzhen.aliyuncs.com/miji/', // oss链接
70     /**
71      * Source Maps
72      */
73
74     productionSourceMap: false, // 打包时不生成map
75     // https://webpack.js.org/configuration/devtool/#production
76     devtool: '#source-map',
77
78     // Gzip off by default as many popular static hosts such as
79     // Surge or Netlify already gzip all static assets for you.
80     // Before setting to `true`, make sure to:
81     // npm install --save-dev compression-webpack-plugin
82     productionGzip: false,
83     productionGzipExtensions: ['js', 'css'],
84
85     // Run the build command with an extra argument to
86     // View the bundle analyzer report after build finishes:
87     // `npm run build --report`
88     // Set to `true` or `false` to always turn it on or off
89     bundleAnalyzerReport: process.env.npm_config_report
aeb317 90   },
J 91   // 配置使用stylus全局变量
92   chainWebpack: config => {
93     // set svg-sprite-loader
94     config.module
95       .rule('svg')
96       .exclude.add(resolve('src/icons'))
97       .end()
98     config.module
99       .rule('icons')
100       .test(/\.svg$/)
101       .include.add(resolve('src/icons'))
102       .end()
103       .use('svg-sprite-loader')
104       .loader('svg-sprite-loader')
105       .options({
106         symbolId: 'icon-[name]'
107       })
108       .end()
3ac5f2 109   }
J 110 }