nuxt.config.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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: ['es2015', 'stage-2'],
  111. // plugins: [
  112. // 'transform-async-to-generator',
  113. // 'transform-runtime'
  114. // ],
  115. // comments: true
  116. // },
  117. // postcss: [
  118. // require('autoprefixer')({
  119. // browsers: ['last 3 versions']
  120. // })
  121. // ]
  122. },
  123. css: [{
  124. src: '~assets/scss/mobileCommon.scss',
  125. lang: 'scss'
  126. },
  127. {
  128. src: '~assets/scss/app.scss',
  129. lang: 'scss'
  130. }
  131. ],
  132. dev: !isProdMode,
  133. env: {
  134. baseUrl,
  135. },
  136. plugins: [
  137. // {
  138. // src: '~plugins/axios-nuxt.js'
  139. // },
  140. // {
  141. // src: '~plugins/axios.js'
  142. // },
  143. {
  144. src: '~plugins/element-ui.js'
  145. }, {
  146. src: '~plugins/mint-ui.js'
  147. }, {
  148. src: '~plugins/filters.js',
  149. ssr: false
  150. }, {
  151. src: '~plugins/jsonp.js',
  152. ssr: false
  153. }, {
  154. src: '~plugins/vuerify.js',
  155. ssr: false
  156. }, {
  157. src: '~plugins/vee-validate.js',
  158. ssr: true
  159. }
  160. ],
  161. /* TODO 代理 */
  162. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**']
  163. }