vue.config.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. const cdn = {
  2. css: [
  3. // '//unpkg.com/element-ui@2.10.1/lib/theme-chalk/index.css'
  4. ],
  5. jsdelivr: [
  6. '//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
  7. '//cdn.jsdelivr.net/npm/vue-router@3.1.5/dist/vue-router.min.js',
  8. '//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
  9. '//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
  10. '//cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js',
  11. '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
  12. '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
  13. ],
  14. js: [
  15. '//cdn-common.jianyu360.cn/cdn/lib/vue/2.6.11/vue.min.js',
  16. '//cdn-common.jianyu360.cn/cdn/lib/vue-router/3.1.5/vue-router.min.js',
  17. '//cdn-common.jianyu360.cn/cdn/lib/vuex/3.4.0/vuex.min.js',
  18. '//cdn-common.jianyu360.cn/cdn/lib/axios/0.19.2/axios.min.js',
  19. '//cdn-common.jianyu360.cn/cdn/lib/echarts/4.8.0/echarts.min.js',
  20. '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
  21. '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
  22. ]
  23. }
  24. module.exports = {
  25. parallel: false,
  26. productionSourceMap: false,
  27. outputDir: 'page_big_pc',
  28. publicPath: process.env.VUE_APP_BASE_PUBLIC,
  29. lintOnSave: true,
  30. devServer: {
  31. port: '8080',
  32. disableHostCheck: true,
  33. proxy: {
  34. // 反爬虫接口代理
  35. // '/subVipPortrait/winner': {
  36. // target: 'http://192.168.20.178:8800',
  37. // changeOrigin: true,
  38. // logLevel: 'debug'
  39. // },
  40. '^/bigmember': {
  41. // target: 'https://web2-jytest.jydev.jianyu360.com',
  42. target: 'http://127.0.0.1:814',
  43. changeOrigin: true,
  44. logLevel: 'debug',
  45. pathRewrite: {
  46. '^/bigmember': '/bigmember'
  47. }
  48. },
  49. '^/jypay': {
  50. // target: 'https://web2-jytest.jydev.jianyu360.com',
  51. target: 'http://127.0.0.1:86',
  52. changeOrigin: true,
  53. logLevel: 'debug'
  54. },
  55. '^/publicapply': {
  56. // target: 'https://web2-jytest.jydev.jianyu360.com',
  57. target: 'http://127.0.0.1:828',
  58. changeOrigin: true,
  59. logLevel: 'debug'
  60. },
  61. '^/subscribepay': {
  62. // target: 'https://web2-jytest.jydev.jianyu360.com',
  63. target: 'http://127.0.0.1:86',
  64. changeOrigin: true,
  65. logLevel: 'debug'
  66. },
  67. '^/salesLeads': {
  68. // target: 'https://web2-jytest.jydev.jianyu360.com',
  69. target: 'http://127.0.0.1:8881',
  70. changeOrigin: true,
  71. logLevel: 'debug'
  72. }
  73. }
  74. },
  75. css: {
  76. loaderOptions: {
  77. sass: {
  78. prependData: '@import "@/assets/style/_mixin.scss";@import "@/assets/style/_variables.scss";'
  79. }
  80. }
  81. },
  82. chainWebpack: config => {
  83. // single-spa
  84. if (!process.env.VUE_APP_ALONE) {
  85. config.devServer.set('inline', false)
  86. config.devServer.set('hot', true)
  87. if (process.env.NODE_ENV === 'production') {
  88. config.externals([
  89. 'vue',
  90. 'vue-router',
  91. 'vuex',
  92. 'axios',
  93. 'lodash',
  94. 'moment'
  95. ])
  96. config.plugin('html').tap(args => {
  97. // html中添加cdn
  98. args[0].cdn = cdn
  99. return args
  100. })
  101. } else {
  102. config.output.filename('js/[name].js')
  103. }
  104. }
  105. // 分析静态资源
  106. if (process.env.use_analyzer) {
  107. config
  108. .plugin('webpack-bundle-analyzer')
  109. .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
  110. }
  111. },
  112. filenameHashing: false
  113. }