nuxt.config.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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://192.168.253.6:23232/')
  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. extractCSS: { allChunks: true },
  40. extend (config, { dev, isClient, isServer }) {
  41. config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  42. config.resolve.alias['~components'] = path.join(__dirname, 'components')
  43. config.resolve.alias['~assets'] = path.join(__dirname, 'assets')
  44. config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  45. config.resolve.alias['~store'] = path.join(__dirname, 'store')
  46. // config.module.rules.push({
  47. // test: /\.scss$/,
  48. // loader: 'vue-style-loader!css-loader!sass-loader'
  49. // })
  50. // config.module.rules.push({
  51. // test: /\.js$/,
  52. // loader: 'babel-loader'
  53. // })
  54. // if (isClient) {
  55. // config.module.rules.push({
  56. // enforce: 'pre',
  57. // test: /\.(js|vue)$/,
  58. // loader: "eslint-loader",
  59. // exclude: /node_modules/
  60. // })
  61. // }
  62. },
  63. vendor: [
  64. 'axios',
  65. 'element-ui',
  66. 'mint-ui',
  67. 'vuerify',
  68. 'vee-validate'
  69. ],
  70. babel: {
  71. presets: ['es2015', 'stage-2'],
  72. plugins: [
  73. 'transform-async-to-generator',
  74. 'transform-runtime'
  75. ],
  76. comments: true
  77. },
  78. postcss: [
  79. require('autoprefixer')({
  80. browsers: ['last 3 versions']
  81. })
  82. ]
  83. },
  84. css: [
  85. '~assets/scss/mobileCommon.scss',
  86. '~assets/scss/app.scss'
  87. ],
  88. dev: !isProdMode,
  89. env: {
  90. baseUrl,
  91. },
  92. plugins: [
  93. {
  94. src: '~plugins/axios-nuxt.js'
  95. },
  96. // {
  97. // src: '~plugins/axios.js'
  98. // },
  99. {
  100. src: '~plugins/element-ui.js'
  101. }, {
  102. src: '~plugins/mint-ui.js'
  103. }, {
  104. src: '~plugins/filters.js',
  105. ssr: false
  106. }, {
  107. src: '~plugins/jsonp.js',
  108. ssr: false
  109. }, {
  110. src: '~plugins/vuerify.js',
  111. ssr: false
  112. }, {
  113. src: '~plugins/vee-validate.js',
  114. ssr: true
  115. }],
  116. /* TODO 代理 */
  117. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**']
  118. }