nuxt.config.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. const seoRouter = require("./plugins/seoRouter");
  2. const pkg = require("./package");
  3. module.exports = {
  4. mode: "universal",
  5. vue: {
  6. config: {
  7. productionTip: process.env.NODE_ENV !== "development",
  8. devtools: process.env.NODE_ENV === "development"
  9. }
  10. },
  11. env: {
  12. baseUrl:
  13. process.env.NODE_ENV == "development"
  14. ? "https://dev.test.proginn.com"
  15. : "https://www.proginn.com",
  16. jishuBaseUrl:
  17. process.env.NODE_ENV == "development"
  18. ? "https://dev.test-jishuin.proginn.com"
  19. : "https://jishuin.proginn.com"
  20. },
  21. /**
  22. * 打包文件
  23. */
  24. build: {
  25. vendor: ["element-ui"]
  26. },
  27. server: {
  28. host: `0.0.0.0`,
  29. port: 3000
  30. },
  31. /*
  32. ** Headers of the page
  33. */
  34. head: {
  35. title: "程序员客栈",
  36. meta: [
  37. { charset: "utf-8" },
  38. { name: "viewport", content: "width=device-width, initial-scale=1" },
  39. { name: "applicable-device", content: "pc, mobile " },
  40. { name: "baidu-site-verification", content: "7IbkIN9Kwp" },
  41. { "http-equiv": "X-UA-Compatible", content: "IE=edge,chrome=1" },
  42. // hid: 'x', 可在页面内覆盖这里
  43. { name: "robots", content: "noindex,follow" },
  44. { name: "description", content: pkg.description },
  45. { "http-equiv": "Cache-Control", content: "no-transform" },
  46. { "http-equiv": "Cache-Control", content: "no-siteapp" }
  47. ],
  48. link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
  49. },
  50. /*
  51. ** Customize the progress-bar color
  52. */
  53. loading: { color: "#fff" },
  54. /*
  55. ** Global CSS
  56. */
  57. css: [
  58. "@/assets/css/common.css",
  59. "@/assets/css/special.css",
  60. "swiper/dist/css/swiper.css"
  61. ],
  62. /*
  63. ** Plugins to load before mounting the App
  64. */
  65. plugins: [
  66. "plugins/common",
  67. "plugins/element",
  68. // 'plugins/http',
  69. "plugins/nuxtAxios",
  70. "plugins/deviceType",
  71. "plugins/vant",
  72. {
  73. src: "plugins/vant.js",
  74. ssr: false
  75. },
  76. {
  77. src: "plugins/rem",
  78. ssr: false
  79. },
  80. {
  81. src: "plugins/vconsole",
  82. ssr: false
  83. },
  84. {
  85. src: "plugins/vue-swiper.js",
  86. ssr: false
  87. },
  88. {
  89. src: "plugins/g2.js",
  90. ssr: false
  91. }
  92. ],
  93. /*
  94. ** Axios module configuration
  95. */
  96. axios: {
  97. // See http://github.com/nuxt-community/axios-module#options
  98. proxy: process.env.NODE_ENV === "development",
  99. // http: true,
  100. progress: true,
  101. // baseURL: process.env.BASE_URL || '',
  102. // browserBaseURL: '',
  103. timeout: 15000,
  104. credentials: true,
  105. proxyHeaders: true
  106. // debug: true
  107. },
  108. /**
  109. * Proxy
  110. */
  111. proxy: [
  112. ["/api", { target: "https://web.test.proginn.com", changeOrigin: true }],
  113. ["/list", { target: "https://dev.test-jishuin.proginn.com", changeOrigin: true }],
  114. [
  115. "/file/proxyUpload",
  116. { target: "https://dev.test.proginn.com", changeOrigin: true }
  117. ],
  118. [
  119. "/file/prepareUpload",
  120. { target: "https://dev.test.proginn.com", changeOrigin: true }
  121. ],
  122. [
  123. "/file/uploadCallback",
  124. { target: "https://dev.test.proginn.com", changeOrigin: true }
  125. ],
  126. // [ '/programmerinnfile', { target: 'https://v0.api.upyun.com', changeOrigin: true } ],
  127. [
  128. "/upload_image",
  129. { target: "http://dev.test.proginn.com", changeOrigin: true }
  130. ],
  131. ["/image", { target: "https://stacdn.proginn.com", changeOrigin: true }]
  132. ],
  133. /*
  134. ** Nuxt.js modules
  135. */
  136. modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],
  137. /*
  138. ** Build configuration
  139. */
  140. build: {
  141. /*
  142. ** You can extend webpack config here
  143. */
  144. // extractCSS: {
  145. // //提取html中的 css到文件
  146. // splitChunks: {
  147. // cacheGroups: {
  148. // styles: {
  149. // name: "styles",
  150. // test: /\.(css|vue|scss|less)$/,
  151. // chunks: "all",
  152. // enforce: true
  153. // }
  154. // }
  155. // }
  156. // },
  157. // optimization: {
  158. // splitChunks: {
  159. // chunks: "all",
  160. // automaticNameDelimiter: ".",
  161. // name: undefined,
  162. // cacheGroups: {}
  163. // }
  164. // },
  165. // extend(config, ctx) {
  166. // config.optimization = {
  167. // splitChunks: {
  168. // chunks: "all",
  169. // automaticNameDelimiter: ".",
  170. // name: undefined,
  171. // cacheGroups: {}
  172. // }
  173. // };
  174. // //console.log(config);
  175. // }
  176. },
  177. router: {
  178. middleware: "initialize",
  179. ...seoRouter
  180. }
  181. };