nuxt.config.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. module.exports = {
  2. mode: 'universal',
  3. env: {
  4. APP_ENV: process.env.APP_ENV
  5. },
  6. /*
  7. ** Headers of the page
  8. */
  9. head: {
  10. title: '海外租房_美国|英国|澳洲|加拿大留学生租房_留学生公寓-hooli社区',
  11. meta: [
  12. { charset: 'utf-8' },
  13. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  14. {
  15. hid: 'keywords',
  16. name: 'keywords',
  17. content:
  18. '海外租房,美国租房,英国租房,澳大利亚租房,加拿大租房,留学生公寓,留学生租房'
  19. },
  20. {
  21. hid: 'description',
  22. name: 'description',
  23. content:
  24. 'hooli社区是解决海外租房,留学生租房问题的网站,提供美国租房、英国租房、澳大利亚租房、加拿大租房等全球热门国家500+城市租房和海外高校生活、留学生租房问题解答。'
  25. }
  26. ],
  27. link: [
  28. {
  29. rel: 'icon',
  30. type: 'image/x-icon',
  31. href: '//static.hoolihome.com/common/default/favicon.ico'
  32. },
  33. {
  34. rel: 'stylesheet',
  35. type: 'text/css',
  36. href: '//at.alicdn.com/t/font_1006590_3emlk7mhe7y.css'
  37. }
  38. ]
  39. },
  40. /*
  41. ** Customize the progress-bar color
  42. */
  43. loading: '~/components/common/MyLoading.vue',
  44. /*
  45. ** Global CSS
  46. */
  47. css: [
  48. {
  49. src: '~/assets/css/main.less',
  50. lang: 'less'
  51. }
  52. ],
  53. /*
  54. ** Plugins to load before mounting the App
  55. */
  56. plugins: [
  57. {
  58. src: '~/plugins/redirect-mobile.js',
  59. ssr: false
  60. },
  61. {
  62. src: '~/plugins/i18n.js',
  63. ssr: true
  64. },
  65. {
  66. src: '~/plugins/axios.js',
  67. ssr: true
  68. },
  69. {
  70. src: '~/plugins/common.js',
  71. ssr: true
  72. },
  73. {
  74. src: '~/plugins/hooliAnalysis.js',
  75. ssr: false
  76. },
  77. {
  78. src: '~/plugins/vue-lazyload.js',
  79. ssr: false
  80. }
  81. ],
  82. /*
  83. ** Nuxt.js modules
  84. */
  85. modules: [
  86. // Doc: https://github.com/nuxt-community/axios-module#usage
  87. '@nuxtjs/axios'
  88. ],
  89. /*
  90. ** Axios module configuration
  91. */
  92. axios: {
  93. // See https://github.com/nuxt-community/axios-module#options
  94. },
  95. /*
  96. ** Build configuration
  97. */
  98. build: {
  99. /*
  100. ** You can extend webpack config here
  101. */
  102. extend(config, ctx) {
  103. // Run ESLint on save
  104. if (ctx.isDev && ctx.isClient) {
  105. config.module.rules.push({
  106. enforce: 'pre',
  107. test: /\.(js|vue)$/,
  108. loader: 'eslint-loader',
  109. exclude: /(node_modules)/
  110. })
  111. }
  112. },
  113. publicPath:
  114. process.env.APP_ENV === 'prod'
  115. ? '//static.hoolihome.com/bbs/nuxt'
  116. : '/_nuxt/' // 可换cdn
  117. },
  118. router: {
  119. middleware: 'i18n'
  120. },
  121. serverMiddleware: ['~/api']
  122. }