nuxt.config.js 5.1 KB

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