nuxt.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. const pkg = require('./package')
  2. module.exports = {
  3. mode: 'universal',
  4. env: {
  5. BASE_URL: process.env.BASE_URL
  6. },
  7. /**
  8. * 打包文件
  9. */
  10. build: {
  11. vendor: ['element-ui']
  12. },
  13. server: {
  14. host: `0.0.0.0`,
  15. port: 3000,
  16. },
  17. /*
  18. ** Headers of the page
  19. */
  20. head: {
  21. title: '程序员客栈',
  22. meta: [
  23. { charset: 'utf-8' },
  24. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  25. { name: 'baidu-site-verification', content: '7IbkIN9Kwp' },
  26. { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
  27. // hid: 'x', 可在页面内覆盖这里
  28. { name: 'robots', content: 'noindex,follow' },
  29. { name: 'description', content: pkg.description },
  30. { 'http-equiv': 'Cache-Control', content: 'no-transform' },
  31. { 'http-equiv': 'Cache-Control', content: 'no-siteapp' },
  32. ],
  33. link: [
  34. { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
  35. ]
  36. },
  37. /*
  38. ** Customize the progress-bar color
  39. */
  40. loading: { color: '#fff' },
  41. /*
  42. ** Global CSS
  43. */
  44. css: [
  45. '@/assets/css/common.css',
  46. '@/assets/css/special.css',
  47. ],
  48. /*
  49. ** Plugins to load before mounting the App
  50. */
  51. plugins: [
  52. 'plugins/common',
  53. 'plugins/element',
  54. // 'plugins/http',
  55. 'plugins/nuxtAxios',
  56. ],
  57. /*
  58. ** Axios module configuration
  59. */
  60. axios: {
  61. // See https://github.com/nuxt-community/axios-module#options
  62. // proxy: true,
  63. // https: true,
  64. progress: true,
  65. // baseURL: process.env.BASE_URL || '',
  66. // browserBaseURL: '',
  67. timeout: 15000,
  68. credentials: true,
  69. proxyHeaders: true,
  70. debug: true
  71. },
  72. /**
  73. * Proxy
  74. */
  75. proxy: [
  76. ['/api', { target: 'https://dev.test.proginn.com', changeOrigin: true }],
  77. ['/image', { target: 'https://stacdn.proginn.com', changeOrigin: true }],
  78. ],
  79. /*
  80. ** Nuxt.js modules
  81. */
  82. modules: [
  83. '@nuxtjs/axios',
  84. '@nuxtjs/proxy',
  85. ],
  86. /*
  87. ** Build configuration
  88. */
  89. build: {
  90. /*
  91. ** You can extend webpack config here
  92. */
  93. extend(config, ctx) {
  94. }
  95. }
  96. }