nuxt.config.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. {
  72. src: "plugins/vant.js",
  73. ssr: false
  74. },
  75. {
  76. src: "plugins/rem",
  77. ssr: false
  78. },
  79. {
  80. src: "plugins/vconsole",
  81. ssr: false
  82. },
  83. {
  84. src: "plugins/vue-swiper.js",
  85. ssr: false
  86. },
  87. {
  88. src: "plugins/g2.js",
  89. ssr: false
  90. }
  91. ],
  92. /*
  93. ** Axios module configuration
  94. */
  95. axios: {
  96. // See http://github.com/nuxt-community/axios-module#options
  97. proxy: process.env.NODE_ENV === "development",
  98. // http: true,
  99. progress: true,
  100. // baseURL: process.env.BASE_URL || '',
  101. // browserBaseURL: '',
  102. timeout: 15000,
  103. credentials: true,
  104. proxyHeaders: true
  105. // debug: true
  106. },
  107. /**
  108. * Proxy
  109. */
  110. proxy: [
  111. ["/api", { target: "https://web.test.proginn.com", changeOrigin: true }],
  112. [
  113. "/file/proxyUpload",
  114. { target: "https://dev.test.proginn.com", changeOrigin: true }
  115. ],
  116. [
  117. "/file/prepareUpload",
  118. { target: "https://dev.test.proginn.com", changeOrigin: true }
  119. ],
  120. [
  121. "/file/uploadCallback",
  122. { target: "https://dev.test.proginn.com", changeOrigin: true }
  123. ],
  124. // [ '/programmerinnfile', { target: 'https://v0.api.upyun.com', changeOrigin: true } ],
  125. [
  126. "/upload_image",
  127. { target: "https://dev.test-jishuin.proginn.com", changeOrigin: true }
  128. ],
  129. ["/image", { target: "https://stacdn.proginn.com", changeOrigin: true }]
  130. ],
  131. /*
  132. ** Nuxt.js modules
  133. */
  134. modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],
  135. /*
  136. ** Build configuration
  137. */
  138. build: {
  139. /*
  140. ** You can extend webpack config here
  141. */
  142. // extractCSS: {
  143. // //提取html中的 css到文件
  144. // splitChunks: {
  145. // cacheGroups: {
  146. // styles: {
  147. // name: "styles",
  148. // test: /\.(css|vue|scss|less)$/,
  149. // chunks: "all",
  150. // enforce: true
  151. // }
  152. // }
  153. // }
  154. // },
  155. // optimization: {
  156. // splitChunks: {
  157. // chunks: "all",
  158. // automaticNameDelimiter: ".",
  159. // name: undefined,
  160. // cacheGroups: {}
  161. // }
  162. // },
  163. // extend(config, ctx) {
  164. // config.optimization = {
  165. // splitChunks: {
  166. // chunks: "all",
  167. // automaticNameDelimiter: ".",
  168. // name: undefined,
  169. // cacheGroups: {}
  170. // }
  171. // };
  172. // //console.log(config);
  173. // }
  174. },
  175. router: {
  176. middleware: "initialize",
  177. ...seoRouter
  178. }
  179. };