vue.config.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. 'use strict'
  2. const path = require('path')
  3. const defaultSettings = require('./src/settings.js')
  4. function resolve(dir) {
  5. return path.join(__dirname, dir)
  6. }
  7. // page title
  8. const name = defaultSettings.title || 'T2'
  9. // If your port is set to 80,
  10. // use administrator privileges to execute the command line.
  11. // For example, Mac: sudo npm run
  12. // You can change the port by the following method:
  13. // port = 9527 npm run dev OR npm run dev --port = 9527
  14. const port = process.env.port || process.env.npm_config_port || 9527 // dev port
  15. /**
  16. * All configuration item explanations can be find in https://cli.vuejs.org/config/
  17. * @type {import('@vue/cli-service').ProjectOptions}
  18. */
  19. module.exports = {
  20. /**
  21. * You will need to set publicPath if you plan to deploy your site under a sub path,
  22. * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
  23. * then publicPath should be set to "/bar/".
  24. * In most cases please use '/' !!!
  25. * Detail: https://cli.vuejs.org/config/#publicpath
  26. */
  27. publicPath: './',
  28. outputDir: 'dist',
  29. assetsDir: 'static',
  30. lintOnSave: process.env.NODE_ENV === 'development',
  31. productionSourceMap: false,
  32. devServer: {
  33. port: port,
  34. open: true,
  35. overlay: {
  36. warnings: false,
  37. errors: true
  38. },
  39. proxy: {
  40. [process.env.VUE_APP_BASE_API]: {
  41. // target: 'http://localhost:9001/clzy', // 服务器端接口地址
  42. target: 'https://msyd.zrzyt.zj.gov.cn/zsch', // 服务器端接口地址
  43. ws: true, // 如果要代理 websockets,配置这个参数
  44. // 如果是https接口,需要配置这个参数
  45. changeOrigin: true, // 是否跨域
  46. pathRewrite: {
  47. ['^' + process.env.VUE_APP_BASE_API]: '/'
  48. }
  49. },
  50. '/test': {
  51. target: 'http://10.36.128.38/tysfw/main/gd/rest/test/geo/lifetime', // 服务器端接口地址
  52. ws: true, // 如果要代理 websockets,配置这个参数
  53. // 如果是https接口,需要配置这个参数
  54. changeOrigin: true, // 是否跨域
  55. pathRewrite: {
  56. '^/test': '/'
  57. }
  58. },
  59. '/v2': {
  60. target: 'http://10.36.128.38/wwkjmht/spcd/project-code/v2', // 服务器端接口地址
  61. ws: true, // 如果要代理 websockets,配置这个参数
  62. // 如果是https接口,需要配置这个参数
  63. changeOrigin: true, // 是否跨域
  64. pathRewrite: {
  65. '^/v2': '/'
  66. }
  67. },
  68. '/tdcsservices': {
  69. target: 'http://10.36.128.38/tdcsservices/arcgis/rest/services/zp', // 服务器端接口地址
  70. ws: true, // 如果要代理 websockets,配置这个参数
  71. // 如果是https接口,需要配置这个参数
  72. changeOrigin: true, // 是否跨域
  73. pathRewrite: {
  74. '^/tdcsservices': '/tdcsservices'
  75. }
  76. },
  77. '/arcMapServer3': {
  78. target: 'https://zdzy.zrzyt.zj.gov.cn/arcMapServer3', // 服务器端接口地址
  79. ws: true, // 如果要代理 websockets,配置这个参数
  80. // 如果是https接口,需要配置这个参数
  81. changeOrigin: true, // 是否跨域
  82. pathRewrite: {
  83. '^/arcMapServer3': '/'
  84. }
  85. },
  86. '/geoserverApi': {
  87. target: 'https://zlzd.zrzyt.zj.gov.cn/', // 服务器端接口地址
  88. ws: true, // 如果要代理 websockets,配置这个参数
  89. // 如果是https接口,需要配置这个参数
  90. changeOrigin: true, // 是否跨域
  91. pathRewrite: {
  92. '^/geoserverApi': '/'
  93. }
  94. },
  95. '/ysbzsApi': {
  96. target: 'https://zlzd.zrzyt.zj.gov.cn/', // 服务器端接口地址
  97. ws: true, // 如果要代理 websockets,配置这个参数
  98. // 如果是https接口,需要配置这个参数
  99. changeOrigin: true, // 是否跨域
  100. pathRewrite: {
  101. '^/ysbzsApi': '/'
  102. }
  103. }
  104. }
  105. // before: require('./mock/mock-server.js')
  106. },
  107. configureWebpack: {
  108. // provide the app's title in webpack's name field, so that
  109. // it can be accessed in index.html to inject the correct title.
  110. name: name,
  111. resolve: {
  112. alias: {
  113. '@': resolve('src')
  114. }
  115. },
  116. devtool: 'source-map'
  117. }
  118. // chainWebpack(config) {
  119. // // set svg-sprite-loader
  120. // config.module
  121. // .rule('svg')
  122. // .exclude.add(resolve('src/icons'))
  123. // .end()
  124. // config.module
  125. // .rule('icons')
  126. // .test(/\.svg$/)
  127. // .include.add(resolve('src/icons'))
  128. // .end()
  129. // .use('svg-sprite-loader')
  130. // .loader('svg-sprite-loader')
  131. // .options({
  132. // symbolId: 'icon-[name]'
  133. // })
  134. // .end()
  135. // config
  136. // .when(process.env.NODE_ENV !== 'development',
  137. // config => {
  138. // config
  139. // .plugin('ScriptExtHtmlWebpackPlugin')
  140. // .after('html')
  141. // .use('script-ext-html-webpack-plugin', [
  142. // {
  143. // // `runtime` must same as runtimeChunk name. default is `runtime`
  144. // inline: /runtime\..*\.js$/
  145. // }
  146. // ])
  147. // .end()
  148. // config
  149. // .optimization.splitChunks({
  150. // chunks: 'all',
  151. // cacheGroups: {
  152. // libs: {
  153. // name: 'chunk-libs',
  154. // test: /[\\/]node_modules[\\/]/,
  155. // priority: 10,
  156. // chunks: 'initial' // only package third parties that are initially dependent
  157. // },
  158. // elementUI: {
  159. // name: 'chunk-ViewDesignUI', // split elementUI into a single package
  160. // priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
  161. // test: /[\\/]node_modules[\\/]_?view-design(.*)/ // in order to adapt to cnpm
  162. // },
  163. // commons: {
  164. // name: 'chunk-commons',
  165. // test: resolve('src/components'), // can customize your rules
  166. // minChunks: 3, // minimum common number
  167. // priority: 5,
  168. // reuseExistingChunk: true
  169. // }
  170. // }
  171. // })
  172. // // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
  173. // config.optimization.runtimeChunk('single')
  174. // }
  175. // )
  176. // }
  177. }