nuxt.config.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. const path = require('path')
  2. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  3. const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:9090/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. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  16. { hid: 'description', name: 'description', content: '优软商城(usoftmall.com)是中国领先的IC电子元器件现货采购交易网上商城,提供上千万种电子元器件现货采购交易,采购电子元器件就上优软商城!' }
  17. ],
  18. link: [
  19. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  20. ]
  21. },
  22. /*
  23. ** Customize the progress-bar color
  24. */
  25. loading: { color: '#3B8070' },
  26. /*
  27. ** Build configuration
  28. */
  29. build: {
  30. /*
  31. ** Run ESLINT on save
  32. */
  33. extend (config, { dev, isClient, isServer }) {
  34. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  35. config.module.rules.push({
  36. test: /\.scss$/,
  37. loader: 'vue-style-loader!css-loader!sass-loader'
  38. })
  39. if (isClient) {
  40. config.module.rules.push({
  41. enforce: 'pre',
  42. test: /\.(js|vue)$/,
  43. loader: 'eslint-loader',
  44. exclude: /(node_modules)/
  45. })
  46. }
  47. },
  48. vendor: [
  49. 'axios',
  50. 'swiper'
  51. ],
  52. babel: {
  53. presets: ['es2015', 'stage-2'],
  54. plugins: [
  55. 'transform-async-to-generator',
  56. 'transform-runtime'
  57. ],
  58. comments: true
  59. },
  60. postcss: [
  61. require('autoprefixer')({
  62. browsers: ['last 3 versions']
  63. })
  64. ]
  65. },
  66. css: [{
  67. src: '~assets/scss/app.scss',
  68. lang: 'scss'
  69. }, {
  70. src: 'swiper/dist/css/swiper.css'
  71. }],
  72. dev: !isProdMode,
  73. env: {
  74. baseUrl
  75. },
  76. plugins: [{
  77. src: '~plugins/axios.js'
  78. }, {
  79. src: '~plugins/swiper.js',
  80. ssr: false
  81. }, {
  82. src: '~plugins/vue-loading.js',
  83. ssr: false
  84. }, {
  85. src: '~plugins/vue-empty.js',
  86. ssr: false
  87. }],
  88. proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/logout/**']
  89. }