vue.config.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. const CompressionPlugin = require('compression-webpack-plugin')
  2. module.exports = {
  3. devServer: {
  4. port: 8091,
  5. open: true,
  6. // 关闭esline
  7. overlay: {
  8. warnings: false,
  9. errors: false,
  10. },
  11. proxy: {
  12. '/wdfn': {
  13. target: 'http://map.wanda.cn',
  14. changeOrigin: true,
  15. pathRewrite: {
  16. '^/wdfn': '/editor',
  17. },
  18. },
  19. '/serve': {
  20. // target: 'http://192.168.200.87:8088/',
  21. // target: 'http://192.168.200.83:8085/',
  22. target: 'http://60.205.177.43:8080', //阿里云
  23. changeOrigin: true,
  24. secure: false,
  25. pathRewrite: {
  26. '^/serve': '',
  27. },
  28. },
  29. '/data': {
  30. // target: 'http://192.168.200.87:9003',
  31. target: 'http://60.205.177.43:9903', //阿里云
  32. changeOrigin: true,
  33. secure: false,
  34. pathRewrite: {
  35. '^/data': '/data',
  36. },
  37. },
  38. },
  39. },
  40. chainWebpack: (config) => {
  41. const svgRule = config.module.rule('svg')
  42. svgRule.uses.clear()
  43. svgRule
  44. .use('babel-loader')
  45. .loader('babel-loader')
  46. .end()
  47. .use('vue-svg-loader')
  48. .loader('vue-svg-loader')
  49. },
  50. lintOnSave: false,
  51. // publicPath: '/dist',
  52. publicPath: '/wandaTopol',
  53. // 打包名称
  54. outputDir: 'wandaTopol',
  55. // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
  56. assetsDir: 'static',
  57. productionSourceMap: false,
  58. // CSS 相关选项
  59. css: {
  60. // 将组件内的 CSS 提取到一个单独的 CSS 文件 (只用在生产环境中)
  61. extract: true,
  62. },
  63. // 配置webpack
  64. configureWebpack: (config) => {
  65. return {
  66. plugins: [
  67. // 压缩代码
  68. new CompressionPlugin({
  69. test: /\.js$|\.html$|.\css/, // 匹配文件名
  70. threshold: 10240, // 对超过10k的数据压缩
  71. deleteOriginalAssets: false, // true 不删除源文件 false 删除源文件
  72. }),
  73. ],
  74. }
  75. },
  76. }