nuxt.config.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/' : 'https://test-sso-server.uuzcc.cn/')
  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. ** Run ESLINT on save
  47. */
  48. extractCSS: {
  49. allChunks: true
  50. },
  51. extend(config, {
  52. dev,
  53. isClient,
  54. isServer
  55. }) {
  56. Object.assign(config.resolve.alias, {
  57. '~utils': path.resolve(__dirname, 'utils'),
  58. '~components': path.join(__dirname, 'components'),
  59. '~assets': path.join(__dirname, 'assets'),
  60. '~plugins': path.join(__dirname, 'plugins'),
  61. '~store': path.join(__dirname, 'store')
  62. })
  63. // nuxt ^2.00 版本后,webpack HtmlWebpackPlguin插件打包 会存在htlm5不能转换的问题
  64. // 已经命令是将 该插件 压缩部分进行重新处理
  65. for (let i = 0; i < config.plugins.length; i++) {
  66. if (config.plugins[i] && config.plugins[i].options && config.plugins[i].options.minify) {
  67. config.plugins[i].options.minify = {
  68. removeAttributeQuotes: true,
  69. collapseWhitespace: true,
  70. html5: true,
  71. minifyCSS: true,
  72. removeComments: true,
  73. removeEmptyAttributes: true,
  74. }
  75. }
  76. }
  77. // config.resolve.alias['~utils'] = path.join(__dirname, 'utils')
  78. // config.resolve.alias['~components'] = path.join(__dirname, 'components')
  79. // config.resolve.alias['assets'] = path.join(__dirname, './assets')
  80. // config.resolve.alias['~plugins'] = path.join(__dirname, 'plugins')
  81. // config.resolve.alias['~store'] = path.join(__dirname, 'store')
  82. // config.module.rules.push({
  83. // test: /\.scss$/,
  84. // loader: 'vue-style-loader!css-loader!sass-loader'
  85. // })
  86. // config.module.rules.push({
  87. // test: /\.js$/,
  88. // loader: 'babel-loader'
  89. // })
  90. // if (isClient) {
  91. // config.module.rules.push({
  92. // enforce: 'pre',
  93. // test: /\.(js|vue)$/,
  94. // loader: "eslint-loader",
  95. // exclude: /node_modules/
  96. // })
  97. // }
  98. },
  99. vendor: [
  100. 'axios',
  101. 'element-ui',
  102. 'mint-ui',
  103. 'vuerify',
  104. 'vee-validate'
  105. ],
  106. babel: {
  107. presets: ['@nuxt/babel-preset-app']
  108. }
  109. // postcss: [
  110. // require('autoprefixer')({
  111. // browsers: ['last 3 versions']
  112. // })
  113. // ]
  114. },
  115. css: [{
  116. src: '~assets/scss/mobileCommon.scss',
  117. lang: 'scss'
  118. },
  119. {
  120. src: '~assets/scss/app.scss',
  121. lang: 'scss'
  122. }
  123. ],
  124. dev: !isProdMode,
  125. env: {
  126. baseUrl,
  127. },
  128. plugins: [
  129. // {
  130. // src: '~plugins/axios-nuxt.js'
  131. // },
  132. // {
  133. // src: '~plugins/axios.js'
  134. // },
  135. {
  136. src: '~plugins/element-ui.js'
  137. }, {
  138. src: '~plugins/mint-ui.js'
  139. }, {
  140. src: '~plugins/filters.js',
  141. ssr: false
  142. }, {
  143. src: '~plugins/jsonp.js',
  144. ssr: false
  145. }, {
  146. src: '~plugins/vuerify.js',
  147. ssr: false
  148. }, {
  149. src: '~plugins/vee-validate.js',
  150. ssr: true
  151. }
  152. ],
  153. /* TODO 代理 */
  154. proxyTable: ['/api/**', '/login/**', '/user**', '/logout**', '/sso/**', '/appeal/**', '/update/user/**', '/valid/**', '/im/**', '/weChat/**', '/bh/**', '/foreign/**']
  155. }