| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- const seoRouter = require("./plugins/seoRouter");
- const pkg = require("./package");
- module.exports = {
- mode: "universal",
- env: {
- baseUrl:
- process.env.NODE_ENV == "development"
- ? "https://dev.test.proginn.com"
- : "https://www.proginn.com",
- jishuBaseUrl:
- process.env.NODE_ENV == "development"
- ? "https://dev.test-jishuin.proginn.com"
- : "https://jishuin.proginn.com"
- },
- /**
- * 打包文件
- */
- build: {
- vendor: ["element-ui"]
- },
- server: {
- host: `0.0.0.0`,
- port: 3000
- },
- /*
- ** Headers of the page
- */
- head: {
- title: "程序员客栈",
- meta: [
- { charset: "utf-8" },
- { name: "viewport", content: "width=device-width, initial-scale=1" },
- { name: "applicable-device", content: "pc, mobile " },
- { name: "baidu-site-verification", content: "7IbkIN9Kwp" },
- { "http-equiv": "X-UA-Compatible", content: "IE=edge,chrome=1" },
- // hid: 'x', 可在页面内覆盖这里
- { name: "robots", content: "noindex,follow" },
- { name: "description", content: pkg.description },
- { "http-equiv": "Cache-Control", content: "no-transform" },
- { "http-equiv": "Cache-Control", content: "no-siteapp" }
- ],
- link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
- },
- /*
- ** Customize the progress-bar color
- */
- loading: { color: "#fff" },
- /*
- ** Global CSS
- */
- css: [
- "@/assets/css/common.css",
- "@/assets/css/special.css",
- "swiper/dist/css/swiper.css"
- ],
- /*
- ** Plugins to load before mounting the App
- */
- plugins: [
- "plugins/common",
- "plugins/element",
- // 'plugins/http',
- "plugins/nuxtAxios",
- "plugins/deviceType",
- {
- src: "plugins/vant.js",
- ssr: false
- },
- {
- src: "plugins/rem",
- ssr: false
- },
- {
- src: "plugins/vconsole",
- ssr: false
- },
- {
- src: "plugins/vue-swiper.js",
- ssr: false
- },
- {
- src: "plugins/g2.js",
- ssr: false
- }
- ],
- /*
- ** Axios module configuration
- */
- axios: {
- // See http://github.com/nuxt-community/axios-module#options
- proxy: process.env.NODE_ENV === "development",
- // http: true,
- progress: true,
- // baseURL: process.env.BASE_URL || '',
- // browserBaseURL: '',
- timeout: 15000,
- credentials: true,
- proxyHeaders: true
- // debug: true
- },
- /**
- * Proxy
- */
- proxy: [
- ["/api", { target: "https://dev.test.proginn.com", changeOrigin: true }],
- [
- "/file/proxyUpload",
- { target: "https://dev.test.proginn.com", changeOrigin: true }
- ],
- [
- "/file/prepareUpload",
- { target: "https://dev.test.proginn.com", changeOrigin: true }
- ],
- [
- "/file/uploadCallback",
- { target: "https://dev.test.proginn.com", changeOrigin: true }
- ],
- // [ '/programmerinnfile', { target: 'https://v0.api.upyun.com', changeOrigin: true } ],
- [
- "/upload_image",
- { target: "https://dev.test-jishuin.proginn.com", changeOrigin: true }
- ],
- ["/image", { target: "https://stacdn.proginn.com", changeOrigin: true }]
- ],
- /*
- ** Nuxt.js modules
- */
- modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],
- /*
- ** Build configuration
- */
- build: {
- /*
- ** You can extend webpack config here
- */
- extractCSS: {
- //提取html中的 css到文件
- splitChunks: {
- cacheGroups: {
- styles: {
- name: "styles",
- test: /\.(css|vue|scss|less)$/,
- chunks: "all",
- enforce: true
- }
- }
- }
- },
- optimization: {
- splitChunks: {
- chunks: "all",
- automaticNameDelimiter: ".",
- name: undefined,
- cacheGroups: {}
- }
- },
- extend(config, ctx) {
- config.optimization = {
- splitChunks: {
- chunks: "all",
- automaticNameDelimiter: ".",
- name: undefined,
- cacheGroups: {}
- }
- };
- //console.log(config);
- }
- },
- router: {
- middleware: "initialize",
- ...seoRouter
- }
- };
|