nuxt.config.js 4.5 KB

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