nuxt.config.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : '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. extend (config, { dev, isClient, isServer }) {
  37. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  38. config.module.rules.push({
  39. test: /\.(scss|css)$/,
  40. loader: 'vue-style-loader!css-loader!sass-loader'
  41. })
  42. config.module.rules.push({
  43. test: /\.js$/,
  44. loader: 'babel-loader'
  45. })
  46. if (isClient) {
  47. config.module.rules.push({
  48. enforce: 'pre',
  49. test: /\.(js|vue)$/,
  50. loader: 'eslint-loader',
  51. exclude: /(node_modules)/
  52. })
  53. }
  54. },
  55. vendor: [
  56. 'axios',
  57. 'swiper',
  58. 'element-ui'
  59. ],
  60. babel: {
  61. presets: ['es2015', 'stage-2'],
  62. plugins: [
  63. 'transform-async-to-generator',
  64. 'transform-runtime'
  65. ],
  66. comments: true
  67. },
  68. postcss: [
  69. require('autoprefixer')({
  70. browsers: ['last 3 versions']
  71. })
  72. ]
  73. },
  74. css: [
  75. { src: '~assets/scss/app.scss', lang: 'scss' }
  76. /* {
  77. src: 'swiper/dist/css/swiper.css'
  78. } */ /* , {
  79. src: 'element-ui/lib/theme-default/index.css'
  80. } */
  81. ],
  82. dev: !isProdMode,
  83. env: {
  84. baseUrl,
  85. commonUrl
  86. },
  87. plugins: [{
  88. src: '~plugins/axios.js'
  89. }, {
  90. src: '~plugins/swiper.js',
  91. ssr: false
  92. }, {
  93. src: '~plugins/vue-loading.js',
  94. ssr: false
  95. }, {
  96. src: '~plugins/vue-empty.js',
  97. ssr: false
  98. }, {
  99. src: '~plugins/element-ui.js',
  100. ssr: true
  101. }, {
  102. src: '~plugins/filters.js',
  103. ssr: false
  104. }, {
  105. src: '~plugins/jsonp.js',
  106. ssr: false
  107. }, {
  108. src: '~plugins/vue-filter.js',
  109. ssr: false
  110. }],
  111. // 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/**']
  112. /**
  113. * http-proxy configuration example: {
  114. * '/api/order/**': 'https://api-order.example.com',
  115. * '/api/product/**': 'https://api-product.example.com'
  116. * }
  117. */
  118. proxyTable: {
  119. '/api/**': baseUrl,
  120. '/search/**': baseUrl,
  121. '/user/**': baseUrl,
  122. '/user**': baseUrl,
  123. '/login/**': baseUrl,
  124. '/register/**': baseUrl,
  125. '/logout/**': baseUrl,
  126. '/static/**': baseUrl,
  127. '/vendor**': baseUrl,
  128. '/trade/**': baseUrl,
  129. '/recommendation/**': baseUrl,
  130. '/store-service/**': baseUrl,
  131. '/basic/**': baseUrl,
  132. '/logout**': baseUrl,
  133. '/operation/**': baseUrl,
  134. '/help**': baseUrl,
  135. '/product**': baseUrl,
  136. '/store**': baseUrl,
  137. '/order/proxy**': baseUrl,
  138. '/report/**': baseUrl,
  139. '/store/**#/**': baseUrl,
  140. '/kdn/**': baseUrl,
  141. '/product/**Submit': baseUrl,
  142. '/admin**': baseUrl,
  143. '/product/**Submit/**': baseUrl,
  144. '/release/**': baseUrl,
  145. '/auth/store/**': baseUrl,
  146. '/produce/**': baseUrl,
  147. '/file**': baseUrl,
  148. '/rate/**': baseUrl,
  149. '/log/**': baseUrl,
  150. '/help-service/**': baseUrl,
  151. '/keyword/**': baseUrl,
  152. '/tip/**': baseUrl,
  153. '/UASBatchPutOnProperty**': baseUrl,
  154. '/UASBatchPutOnProperty/**': baseUrl,
  155. '/seek/**': baseUrl,
  156. '/inquiry/**': commonUrl
  157. }
  158. }