nuxt.config.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
  4. const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
  5. const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
  6. module.exports = {
  7. router: {
  8. middleware: 'check-auth'
  9. },
  10. /*
  11. ** Headers of the page
  12. */
  13. head: {
  14. title: '【优软商城】IC电子元器件现货采购交易平台商城',
  15. meta: [
  16. { charset: 'utf-8' },
  17. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  18. { name: 'render', content: 'webkit' },
  19. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  20. { hid: 'description', name: 'description', content: '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!' }
  21. ],
  22. link: [
  23. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  24. ]
  25. },
  26. /*
  27. ** loading Style
  28. */
  29. loading: '~components/common/loading/Loading.vue',
  30. /*
  31. ** Build configuration
  32. */
  33. build: {
  34. /*
  35. ** Run ESLINT on save
  36. */
  37. extractCSS: { allChunks: true },
  38. extend(config, { isDev, isClient, isServer }) {
  39. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  40. config.resolve.alias['~components'] = path.join(__dirname, 'components')
  41. config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  42. config.resolve.alias['~store'] = path.join(__dirname, 'store')
  43. config.resolve.alias['~assets'] = path.join(__dirname, 'assets')
  44. // config.module.rules.push({
  45. // test: /\.scss$/,
  46. // loader: 'style-loader!css-loader!sass-loader'
  47. // })
  48. if (isClient) {
  49. config.module.rules.push({
  50. enforce: 'pre',
  51. test: /\.(js|vue)$/,
  52. loader: 'eslint-loader',
  53. exclude: /(node_modules)/
  54. })
  55. }
  56. },
  57. vendor: [
  58. 'axios',
  59. 'swiper',
  60. 'element-ui'
  61. ],
  62. babel: {
  63. presets: ['es2015', 'stage-2'],
  64. plugins: [
  65. 'transform-async-to-generator',
  66. 'transform-runtime'
  67. ],
  68. comments: true
  69. },
  70. postcss: [
  71. require('autoprefixer')({
  72. browsers: ['last 3 versions']
  73. })
  74. ]
  75. },
  76. css: [
  77. '~assets/scss/app.scss'
  78. ],
  79. dev: !isProdMode,
  80. env: {
  81. baseUrl,
  82. commonUrl,
  83. materialUrl
  84. },
  85. plugins: [
  86. {
  87. src: '~plugins/axios.js'
  88. },
  89. {
  90. src: '~plugins/vue-filter.js'
  91. }, {
  92. src: '~plugins/mixin.js'
  93. }, {
  94. src: '~plugins/swiper.js',
  95. ssr: false
  96. }, {
  97. src: '~plugins/vue-loading.js',
  98. ssr: false
  99. }, {
  100. src: '~plugins/vue-empty.js',
  101. ssr: false
  102. }, {
  103. src: '~plugins/element-ui.js',
  104. ssr: true
  105. }, {
  106. src: '~plugins/filters.js',
  107. ssr: false
  108. }, {
  109. src: '~plugins/jsonp.js',
  110. ssr: false
  111. }],
  112. // proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**', '/tip/**', '/UASBatchPutOnProperty**', '/UASBatchPutOnProperty/**']
  113. /**
  114. * http-proxy configuration example: {
  115. * '/api/order/**': 'https://api-order.example.com',
  116. * '/api/product/**': 'https://api-product.example.com'
  117. * }
  118. */
  119. modules: [
  120. ],
  121. proxyTable: {
  122. '/api/**': baseUrl,
  123. '/search/**': baseUrl,
  124. '/user/**': baseUrl,
  125. '/user**': baseUrl,
  126. '/login/**': baseUrl,
  127. '/newLogin/**': baseUrl,
  128. '/mPassWord/page': baseUrl,
  129. '/mEmail/page': baseUrl,
  130. '/mPhone/page': baseUrl,
  131. '/mQuestion/page': baseUrl,
  132. '/realNameAuth/page': baseUrl,
  133. '/register/**': baseUrl,
  134. '/logout/**': baseUrl,
  135. '/static/**': baseUrl,
  136. '/vendor**': baseUrl,
  137. '/trade/**': baseUrl,
  138. '/recommendation/**': baseUrl,
  139. '/store-service/**': baseUrl,
  140. '/basic/**': baseUrl,
  141. '/logout**': baseUrl,
  142. '/operation/**': baseUrl,
  143. '/help**': baseUrl,
  144. '/product**': baseUrl,
  145. '/store**': baseUrl,
  146. '/order/proxy**': baseUrl,
  147. '/report/**': baseUrl,
  148. '/store/**#/**': baseUrl,
  149. '/kdn/**': baseUrl,
  150. '/product/**Submit': baseUrl,
  151. '/admin**': baseUrl,
  152. '/product/**Submit/**': baseUrl,
  153. '/release/**': baseUrl,
  154. '/auth/store/**': baseUrl,
  155. '/produce/**': baseUrl,
  156. '/file**': baseUrl,
  157. '/rate/**': baseUrl,
  158. '/log/**': baseUrl,
  159. '/help-service/**': baseUrl,
  160. '/keyword/**': baseUrl,
  161. '/tip/**': baseUrl,
  162. '/UASBatchPutOnProperty**': baseUrl,
  163. '/UASBatchPutOnProperty/**': baseUrl,
  164. '/seek/**': baseUrl,
  165. '/inquiry/**': commonUrl,
  166. '/b2b/**': baseUrl,
  167. '/commodity-service/**': baseUrl,
  168. '/background/**': baseUrl,
  169. '/goods/**': baseUrl,
  170. // 公共物料匹配类目
  171. '/productuser/**': materialUrl,
  172. // 权限管理
  173. '/account/**': baseUrl
  174. }
  175. }