nuxt.config.js 5.7 KB

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