vue.config.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. const path = require('path')
  2. const pxtorem = require('postcss-pxtorem')
  3. const version = new Date().getTime();
  4. module.exports = {
  5. lintOnSave: false,
  6. // lintOnSave: process.env.NODE_ENV !== 'production',
  7. publicPath: './', // 基本路径
  8. outputDir: 'dist', // 输出文件目录
  9. assetsDir: './assets',
  10. productionSourceMap: false,
  11. transpileDependencies: ['@supermap/iclient-common', '@supermap/iclient-leaflet'],
  12. devServer: {
  13. host: '0.0.0.0', // can be overwritten by process.env.HOST
  14. port: 8082, // 端口配置
  15. proxy: {
  16. "/arcMapServer/": {
  17. target: "http://10.36.128.38/", // 服务器端接口地址
  18. // target: "http://59.202.43.95:8801/spaceproject/",
  19. ws: true, //如果要代理 websockets,配置这个参数
  20. // 如果是https接口,需要配置这个参数
  21. changeOrigin: true, //是否跨域
  22. pathRewrite: {
  23. "^/arcMapServer": "/"
  24. }
  25. },
  26. "/arcMapServerTwo": {
  27. target: "http://10.249.2.51:6080/", // 服务器端接口地址
  28. ws: true, //如果要代理 websockets,配置这个参数
  29. // 如果是https接口,需要配置这个参数
  30. changeOrigin: true, //是否跨域
  31. pathRewrite: {
  32. "^/arcMapServerTwo": "/"
  33. }
  34. },
  35. '/ysgzybz': {
  36. // target: 'http://59.202.43.95:8801/kjzz/', // 服务器端接口地址
  37. target: 'https://zlzd.zrzyt.zj.gov.cn/app215/ybz-api/', // 服务器端接口地址
  38. ws: true, // 如果要代理 websockets,配置这个参数
  39. // 如果是https接口,需要配置这个参数
  40. changeOrigin: true, // 是否跨域
  41. pathRewrite: {
  42. '^/ysgzybz': '/'
  43. }
  44. },
  45. '/arcMapServer2': {
  46. // target: 'http://59.202.43.95:8801/kjzz/', // 服务器端接口地址
  47. target: 'https://zdzy.zrzyt.zj.gov.cn/', // 服务器端接口地址
  48. ws: true, // 如果要代理 websockets,配置这个参数
  49. // 如果是https接口,需要配置这个参数
  50. changeOrigin: true, // 是否跨域
  51. pathRewrite: {
  52. '^/arcMapServer2': '/arcMapServer'
  53. }
  54. },
  55. '/gdzb': {
  56. target: 'https://gdzb.zrzyt.zj.gov.cn:10200/', // 服务器端接口地址
  57. ws: true, // 如果要代理 websockets,配置这个参数
  58. changeOrigin: true, // 是否跨域
  59. pathRewrite: {
  60. '^/gdzb': '/'
  61. }
  62. },
  63. '/zdzg': {
  64. target: 'https://kjly.zrzyt.zj.gov.cn:8184/', // 服务器端接口地址
  65. ws: true, // 如果要代理 websockets,配置这个参数
  66. changeOrigin: true, // 是否跨域
  67. pathRewrite: {
  68. '^/zdzg': '/'
  69. }
  70. },
  71. },
  72. overlay: {
  73. warnings: true,
  74. errors: false
  75. }
  76. },
  77. configureWebpack: {
  78. output: {
  79. sourcePrefix: " ",
  80. filename: `js/[name].${version}.js`,
  81. chunkFilename: `js/[name].${version}.js`
  82. },
  83. amd: {
  84. toUrlUndefined: true
  85. },
  86. resolve: {
  87. alias: {
  88. 'vue$': 'vue/dist/vue.esm.js',
  89. '@': path.resolve('src'),
  90. 'txml/txml': 'txml/dist/txml'
  91. // 'cesium': path.resolve(__dirname, cesiumSource)
  92. }
  93. },
  94. plugins: [
  95. // new CopyWebpackPlugin([{ from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' }]),
  96. // new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Assets'), to: 'Assets' }]),
  97. // new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' }]),
  98. // new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'ThirdParty/Workers'), to: 'ThirdParty/Workers' }]),
  99. // new webpack.DefinePlugin({
  100. // CESIUM_BASE_URL: JSON.stringify('./')
  101. // })
  102. ],
  103. module: {
  104. unknownContextCritical: /^.\/.*$/,
  105. unknownContextCritical: false
  106. }
  107. },
  108. // 给css添加版本号
  109. // chainWebpack: config => {
  110. // config.plugin('extract-css').tap(args => [
  111. // {
  112. // filename: `assets/css/[name].${version}.css`,
  113. // chunkFilename: `assets/css/[name].${version}.css`
  114. // }
  115. // ])
  116. // }
  117. css: {
  118. extract: { ignoreOrder: true },
  119. loaderOptions: {
  120. postcss: {
  121. plugins: [
  122. pxtorem({
  123. rootValue: 37.5,//这个尺寸可以根据自己的图去配置,这里配置的是宽度375的图(如果用了vant插件)
  124. propList: ['*'],
  125. selectorBlackList: ['van-circle__layer']
  126. })
  127. ]
  128. }
  129. }
  130. }
  131. }