nuxt.config.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://10.1.51.90:8080/platform-b2c/')
  4. module.exports = {
  5. router: {
  6. middleware: 'check-auth'
  7. },
  8. /*
  9. ** Headers of the page
  10. */
  11. head: {
  12. title: '【优软商城】IC电子元器件现货采购交易平台商城',
  13. meta: [
  14. { charset: 'utf-8' },
  15. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  16. { name: 'render', content: 'webkit' },
  17. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  18. { hid: 'description', name: 'description', content: '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!' }
  19. ],
  20. link: [
  21. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  22. ]
  23. },
  24. /*
  25. ** loading Style
  26. */
  27. loading: '~components/common/loading/Loading.vue',
  28. /*
  29. ** Build configuration
  30. */
  31. build: {
  32. /*
  33. ** Run ESLINT on save
  34. */
  35. extend (config, { dev, isClient, isServer }) {
  36. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  37. config.module.rules.push({
  38. test: /\.(scss|css)$/,
  39. loader: 'vue-style-loader!css-loader!sass-loader'
  40. })
  41. config.module.rules.push({
  42. test: /\.js$/,
  43. loader: 'babel-loader'
  44. })
  45. if (isClient) {
  46. config.module.rules.push({
  47. enforce: 'pre',
  48. test: /\.(js|vue)$/,
  49. loader: 'eslint-loader',
  50. exclude: /(node_modules)/
  51. })
  52. }
  53. },
  54. vendor: [
  55. 'axios',
  56. 'swiper',
  57. 'element-ui'
  58. ],
  59. babel: {
  60. presets: ['es2015', 'stage-2'],
  61. plugins: [
  62. 'transform-async-to-generator',
  63. 'transform-runtime'
  64. ],
  65. comments: true
  66. },
  67. postcss: [
  68. require('autoprefixer')({
  69. browsers: ['last 3 versions']
  70. })
  71. ]
  72. },
  73. css: [
  74. { src: '~assets/scss/app.scss', lang: 'scss' }
  75. /* {
  76. src: 'swiper/dist/css/swiper.css'
  77. } */ /* , {
  78. src: 'element-ui/lib/theme-default/index.css'
  79. } */
  80. ],
  81. dev: !isProdMode,
  82. env: {
  83. baseUrl
  84. },
  85. plugins: [{
  86. src: '~plugins/axios.js'
  87. }, {
  88. src: '~plugins/swiper.js',
  89. ssr: false
  90. }, {
  91. src: '~plugins/vue-loading.js',
  92. ssr: false
  93. }, {
  94. src: '~plugins/vue-empty.js',
  95. ssr: false
  96. }, {
  97. src: '~plugins/element-ui.js',
  98. ssr: true
  99. }, {
  100. src: '~plugins/filters.js',
  101. ssr: false
  102. }, {
  103. src: '~plugins/jsonp.js',
  104. ssr: false
  105. }],
  106. /* TODO 暂时代理到商城测试版,之后再做出调整 */
  107. 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/**']
  108. }