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