nuxt.config.js 2.6 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 ? 'https://sso.ubtob.com/' : 'http://10.1.51.50:8081/')
  4. module.exports = {
  5. router: {
  6. middleware: 'check-auth'
  7. },
  8. transition: {
  9. name: 'fade',
  10. mode: 'out-in'
  11. },
  12. /*
  13. ** Headers of the page
  14. */
  15. head: {
  16. title: '账户中心',
  17. meta: [
  18. { charset: 'utf-8' },
  19. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  20. { name: 'render', content: 'webkit' },
  21. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  22. { hid: 'description', name: 'description', content: '账户中心' }
  23. ],
  24. link: [
  25. { rel: 'icon', type: 'image/x-icon', href: '/U.png' }
  26. ]
  27. },
  28. /*
  29. ** Customize the progress-bar color
  30. */
  31. loading: '~components/common/nuxt-loading/Loading.vue',
  32. /*
  33. ** Build configuration
  34. */
  35. build: {
  36. /*
  37. ** Run ESLINT on save
  38. */
  39. extend (config, { dev, isClient, isServer }) {
  40. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  41. config.module.rules.push({
  42. test: /\.scss$/,
  43. loader: 'vue-style-loader!css-loader!sass-loader'
  44. })
  45. config.module.rules.push({
  46. test: /\.js$/,
  47. loader: 'babel-loader'
  48. })
  49. if (isClient) {
  50. config.module.rules.push({
  51. enforce: 'pre',
  52. test: /\.(js|vue)$/,
  53. loader: 'eslint-loader',
  54. exclude: /(node_modules)/
  55. })
  56. }
  57. },
  58. vendor: [
  59. 'axios',
  60. 'element-ui',
  61. 'mint-ui',
  62. 'vuerify',
  63. 'vee-validate'
  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. {src: '~assets/scss/mobileCommon.scss', lang: 'scss'},
  81. {src: '~assets/scss/app.scss', lang: 'scss'}
  82. ],
  83. dev: !isProdMode,
  84. env: {
  85. baseUrl,
  86. },
  87. plugins: [{
  88. src: '~plugins/axios.js'
  89. }, {
  90. src: '~plugins/element-ui.js'
  91. }, {
  92. src: '~plugins/mint-ui.js'
  93. }, {
  94. src: '~plugins/filters.js',
  95. ssr: false
  96. }, {
  97. src: '~plugins/jsonp.js',
  98. ssr: false
  99. }, {
  100. src: '~plugins/vuerify.js',
  101. ssr: false
  102. }, {
  103. src: '~plugins/vee-validate.js',
  104. ssr: true
  105. }],
  106. /* TODO 暂时代理到商城测试版,之后再做出调整 */
  107. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**']
  108. }