nuxt.config.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. var HtmlWebpackPlugin = require('html-webpack-plugin');
  2. const path = require('path')
  3. const isProdMode = Object.is(process.env.NODE_ENV, 'production')
  4. const baseUrl = process.env.BASE_URL || (isProdMode ? 'https://sso.ubtob.com/' : 'https://test-sso-server.uuzcc.cn/')
  5. module.exports = {
  6. router: {
  7. middleware: 'check-auth'
  8. },
  9. transition: {
  10. name: 'fade',
  11. mode: 'out-in'
  12. },
  13. /*
  14. ** Headers of the page
  15. */
  16. head: {
  17. title: '账户中心',
  18. meta: [{
  19. charset: 'utf-8'
  20. },
  21. {
  22. 'http-equiv': 'X-UA-Compatible',
  23. content: 'IE=edge,chrome=1'
  24. },
  25. {
  26. name: 'render',
  27. content: 'webkit'
  28. },
  29. {
  30. name: 'viewport',
  31. content: 'width=device-width, initial-scale=1'
  32. },
  33. {
  34. hid: 'description',
  35. name: 'description',
  36. content: '账户中心'
  37. }
  38. ],
  39. link: [{
  40. rel: 'icon',
  41. type: 'image/x-icon',
  42. href: '/U.png'
  43. }]
  44. },
  45. /*
  46. ** Customize the progress-bar color
  47. */
  48. loading: '~components/common/nuxt-loading/Loading.vue',
  49. /*
  50. ** Build configuration
  51. */
  52. build: {
  53. /*
  54. ** Run ESLINT on save
  55. */
  56. extractCSS: {
  57. allChunks: true
  58. },
  59. extend(config, {
  60. dev,
  61. isClient,
  62. isServer
  63. }) {
  64. Object.assign(config.resolve.alias, {
  65. '~utils': path.resolve(__dirname, 'utils'),
  66. '~components': path.join(__dirname, 'components'),
  67. '~assets': path.join(__dirname, 'assets'),
  68. '~plugins': path.join(__dirname, 'plugins'),
  69. '~store': path.join(__dirname, 'store')
  70. })
  71. // console.log( config.plugins)
  72. // config.plugins.push(new HtmlWebpackPlugin({
  73. // title: 'React Title !',
  74. // template: './app.html',
  75. // minify: {
  76. // removeAttributeQuotes: true
  77. // },
  78. // inject: 'body'
  79. // }))
  80. // config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  81. // config.resolve.alias['~components'] = path.join(__dirname, 'components')
  82. // config.resolve.alias['assets'] = path.join(__dirname, './assets')
  83. // config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  84. // config.resolve.alias['~store'] = path.join(__dirname, 'store')
  85. // config.module.rules.push({
  86. // test: /\.scss$/,
  87. // loader: 'vue-style-loader!css-loader!sass-loader'
  88. // })
  89. // config.module.rules.push({
  90. // test: /\.js$/,
  91. // loader: 'babel-loader'
  92. // })
  93. // if (isClient) {
  94. // config.module.rules.push({
  95. // enforce: 'pre',
  96. // test: /\.(js|vue)$/,
  97. // loader: "eslint-loader",
  98. // exclude: /node_modules/
  99. // })
  100. // }
  101. },
  102. vendor: [
  103. 'axios',
  104. 'element-ui',
  105. 'mint-ui',
  106. 'vuerify',
  107. 'vee-validate'
  108. ],
  109. babel: {
  110. presets: ['@nuxt/babel-preset-app']
  111. }
  112. // postcss: [
  113. // require('autoprefixer')({
  114. // browsers: ['last 3 versions']
  115. // })
  116. // ]
  117. },
  118. css: [{
  119. src: '~assets/scss/mobileCommon.scss',
  120. lang: 'scss'
  121. },
  122. {
  123. src: '~assets/scss/app.scss',
  124. lang: 'scss'
  125. }
  126. ],
  127. dev: !isProdMode,
  128. env: {
  129. baseUrl,
  130. },
  131. plugins: [
  132. // {
  133. // src: '~plugins/axios-nuxt.js'
  134. // },
  135. // {
  136. // src: '~plugins/axios.js'
  137. // },
  138. {
  139. src: '~plugins/element-ui.js'
  140. }, {
  141. src: '~plugins/mint-ui.js'
  142. }, {
  143. src: '~plugins/filters.js',
  144. ssr: false
  145. }, {
  146. src: '~plugins/jsonp.js',
  147. ssr: false
  148. }, {
  149. src: '~plugins/vuerify.js',
  150. ssr: false
  151. }, {
  152. src: '~plugins/vee-validate.js',
  153. ssr: true
  154. }
  155. ],
  156. /* TODO 代理 */
  157. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**']
  158. }