nuxt.config.js 5.4 KB

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