nuxt.config.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. if (config.plugins[4] && config.plugins[4].options && config.plugins[4].options.minify) {
  72. config.plugins[4].options.minify = {
  73. removeAttributeQuotes: true,
  74. collapseWhitespace: true,
  75. html5: true,
  76. minifyCSS: true,
  77. removeComments: true,
  78. removeEmptyAttributes: true,
  79. }
  80. }
  81. if (config.plugins[5] && config.plugins[5].options && config.plugins[5].options.minify) {
  82. config.plugins[5].options.minify = {
  83. removeAttributeQuotes: true,
  84. collapseWhitespace: true,
  85. html5: true,
  86. minifyCSS: true,
  87. removeComments: true,
  88. removeEmptyAttributes: true,
  89. }
  90. }
  91. // config.plugins.push(new HtmlWebpackPlugin({
  92. // title: 'React Title !',
  93. // template: './app.html',
  94. // minify: {
  95. // removeAttributeQuotes: true
  96. // },
  97. // inject: 'body'
  98. // }))
  99. // config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  100. // config.resolve.alias['~components'] = path.join(__dirname, 'components')
  101. // config.resolve.alias['assets'] = path.join(__dirname, './assets')
  102. // config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  103. // config.resolve.alias['~store'] = path.join(__dirname, 'store')
  104. // config.module.rules.push({
  105. // test: /\.scss$/,
  106. // loader: 'vue-style-loader!css-loader!sass-loader'
  107. // })
  108. // config.module.rules.push({
  109. // test: /\.js$/,
  110. // loader: 'babel-loader'
  111. // })
  112. // if (isClient) {
  113. // config.module.rules.push({
  114. // enforce: 'pre',
  115. // test: /\.(js|vue)$/,
  116. // loader: "eslint-loader",
  117. // exclude: /node_modules/
  118. // })
  119. // }
  120. },
  121. vendor: [
  122. 'axios',
  123. 'element-ui',
  124. 'mint-ui',
  125. 'vuerify',
  126. 'vee-validate'
  127. ],
  128. babel: {
  129. presets: ['@nuxt/babel-preset-app']
  130. }
  131. // postcss: [
  132. // require('autoprefixer')({
  133. // browsers: ['last 3 versions']
  134. // })
  135. // ]
  136. },
  137. css: [{
  138. src: '~assets/scss/mobileCommon.scss',
  139. lang: 'scss'
  140. },
  141. {
  142. src: '~assets/scss/app.scss',
  143. lang: 'scss'
  144. }
  145. ],
  146. dev: !isProdMode,
  147. env: {
  148. baseUrl,
  149. },
  150. plugins: [
  151. // {
  152. // src: '~plugins/axios-nuxt.js'
  153. // },
  154. // {
  155. // src: '~plugins/axios.js'
  156. // },
  157. {
  158. src: '~plugins/element-ui.js'
  159. }, {
  160. src: '~plugins/mint-ui.js'
  161. }, {
  162. src: '~plugins/filters.js',
  163. ssr: false
  164. }, {
  165. src: '~plugins/jsonp.js',
  166. ssr: false
  167. }, {
  168. src: '~plugins/vuerify.js',
  169. ssr: false
  170. }, {
  171. src: '~plugins/vee-validate.js',
  172. ssr: true
  173. }
  174. ],
  175. /* TODO 代理 */
  176. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**']
  177. }