nuxt.config.js 5.9 KB

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