|
@@ -1,73 +1,79 @@
|
|
|
-const pkg = require('./package');
|
|
|
|
|
-const cheerio = require('cheerio')
|
|
|
|
|
|
|
+const pkg = require("./package");
|
|
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
- mode: 'universal',
|
|
|
|
|
-
|
|
|
|
|
|
|
+ mode: "universal",
|
|
|
|
|
+
|
|
|
env: {
|
|
env: {
|
|
|
- baseUrl: process.env.NODE_ENV == 'development' ? 'https://dev.test.proginn.com' : 'https://www.proginn.com',
|
|
|
|
|
|
|
+ baseUrl:
|
|
|
|
|
+ process.env.NODE_ENV == "development"
|
|
|
|
|
+ ? "https://dev.test.proginn.com"
|
|
|
|
|
+ : "https://www.proginn.com",
|
|
|
jishuBaseUrl:
|
|
jishuBaseUrl:
|
|
|
- process.env.NODE_ENV == 'development'
|
|
|
|
|
- ? 'https://dev.test-jishuin.proginn.com'
|
|
|
|
|
- : 'https://jishuin.proginn.com'
|
|
|
|
|
|
|
+ process.env.NODE_ENV == "development"
|
|
|
|
|
+ ? "https://dev.test-jishuin.proginn.com"
|
|
|
|
|
+ : "https://jishuin.proginn.com"
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 打包文件
|
|
* 打包文件
|
|
|
*/
|
|
*/
|
|
|
build: {
|
|
build: {
|
|
|
- vendor: [ 'element-ui' ],
|
|
|
|
|
|
|
+ vendor: ["element-ui"]
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
server: {
|
|
server: {
|
|
|
host: `0.0.0.0`,
|
|
host: `0.0.0.0`,
|
|
|
port: 3000
|
|
port: 3000
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- ** Headers of the page
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ ** Headers of the page
|
|
|
|
|
+ */
|
|
|
head: {
|
|
head: {
|
|
|
- title: '程序员客栈',
|
|
|
|
|
|
|
+ title: "程序员客栈",
|
|
|
meta: [
|
|
meta: [
|
|
|
- { charset: 'utf-8' },
|
|
|
|
|
- { name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
|
|
|
- { name: 'baidu-site-verification', content: '7IbkIN9Kwp' },
|
|
|
|
|
- { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge,chrome=1' },
|
|
|
|
|
|
|
+ { charset: "utf-8" },
|
|
|
|
|
+ { name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
|
|
|
+ { name: "baidu-site-verification", content: "7IbkIN9Kwp" },
|
|
|
|
|
+ { "http-equiv": "X-UA-Compatible", content: "IE=edge,chrome=1" },
|
|
|
// hid: 'x', 可在页面内覆盖这里
|
|
// 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' }
|
|
|
|
|
|
|
+ { 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' } ]
|
|
|
|
|
|
|
+ link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- ** Customize the progress-bar color
|
|
|
|
|
- */
|
|
|
|
|
- loading: { color: '#fff' },
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ** Customize the progress-bar color
|
|
|
|
|
+ */
|
|
|
|
|
+ loading: { color: "#fff" },
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- ** Global CSS
|
|
|
|
|
- */
|
|
|
|
|
- css: [ '@/assets/css/common.css', '@/assets/css/special.css', 'swiper/dist/css/swiper.css' ],
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ** Global CSS
|
|
|
|
|
+ */
|
|
|
|
|
+ css: [
|
|
|
|
|
+ "@/assets/css/common.css",
|
|
|
|
|
+ "@/assets/css/special.css",
|
|
|
|
|
+ "swiper/dist/css/swiper.css"
|
|
|
|
|
+ ],
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- ** Plugins to load before mounting the App
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ ** Plugins to load before mounting the App
|
|
|
|
|
+ */
|
|
|
plugins: [
|
|
plugins: [
|
|
|
- 'plugins/common',
|
|
|
|
|
- 'plugins/element',
|
|
|
|
|
|
|
+ "plugins/common",
|
|
|
|
|
+ "plugins/element",
|
|
|
// 'plugins/http',
|
|
// 'plugins/http',
|
|
|
- 'plugins/nuxtAxios',
|
|
|
|
|
- 'plugins/deviceType',
|
|
|
|
|
|
|
+ "plugins/nuxtAxios",
|
|
|
|
|
+ "plugins/deviceType",
|
|
|
{
|
|
{
|
|
|
- src: 'plugins/rem',
|
|
|
|
|
|
|
+ src: "plugins/rem",
|
|
|
ssr: false
|
|
ssr: false
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- src: 'plugins/vconsole',
|
|
|
|
|
|
|
+ src: "plugins/vconsole",
|
|
|
ssr: false
|
|
ssr: false
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -80,11 +86,11 @@ module.exports = {
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
/*
|
|
/*
|
|
|
- ** Axios module configuration
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ ** Axios module configuration
|
|
|
|
|
+ */
|
|
|
axios: {
|
|
axios: {
|
|
|
// See http://github.com/nuxt-community/axios-module#options
|
|
// See http://github.com/nuxt-community/axios-module#options
|
|
|
- proxy: process.env.NODE_ENV === 'development',
|
|
|
|
|
|
|
+ proxy: process.env.NODE_ENV === "development",
|
|
|
// http: true,
|
|
// http: true,
|
|
|
progress: true,
|
|
progress: true,
|
|
|
// baseURL: process.env.BASE_URL || '',
|
|
// baseURL: process.env.BASE_URL || '',
|
|
@@ -98,54 +104,73 @@ module.exports = {
|
|
|
* Proxy
|
|
* Proxy
|
|
|
*/
|
|
*/
|
|
|
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 } ],
|
|
|
|
|
|
|
+ ["/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 } ],
|
|
// [ '/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 } ]
|
|
|
|
|
|
|
+ [
|
|
|
|
|
+ "/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' ],
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ** Nuxt.js modules
|
|
|
|
|
+ */
|
|
|
|
|
+ modules: ["@nuxtjs/axios", "@nuxtjs/proxy"],
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- ** Build configuration
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ ** Build configuration
|
|
|
|
|
+ */
|
|
|
build: {
|
|
build: {
|
|
|
/*
|
|
/*
|
|
|
- ** You can extend webpack config here
|
|
|
|
|
- */
|
|
|
|
|
- extractCSS: { //提取html中的 css到文件
|
|
|
|
|
|
|
+ ** You can extend webpack config here
|
|
|
|
|
+ */
|
|
|
|
|
+ extractCSS: {
|
|
|
|
|
+ //提取html中的 css到文件
|
|
|
splitChunks: {
|
|
splitChunks: {
|
|
|
cacheGroups: {
|
|
cacheGroups: {
|
|
|
styles: {
|
|
styles: {
|
|
|
- name: 'styles',
|
|
|
|
|
|
|
+ name: "styles",
|
|
|
test: /\.(css|vue|scss|less)$/,
|
|
test: /\.(css|vue|scss|less)$/,
|
|
|
- chunks: 'all',
|
|
|
|
|
|
|
+ chunks: "all",
|
|
|
enforce: true
|
|
enforce: true
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ optimization: {
|
|
|
|
|
+ splitChunks: {
|
|
|
|
|
+ chunks: "all",
|
|
|
|
|
+ automaticNameDelimiter: ".",
|
|
|
|
|
+ name: undefined,
|
|
|
|
|
+ cacheGroups: {}
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
extend(config, ctx) {
|
|
extend(config, ctx) {
|
|
|
- console.log(config);
|
|
|
|
|
|
|
+ config.optimization = {
|
|
|
|
|
+ splitChunks: {
|
|
|
|
|
+ chunks: "all",
|
|
|
|
|
+ automaticNameDelimiter: ".",
|
|
|
|
|
+ name: undefined,
|
|
|
|
|
+ cacheGroups: {}
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ //console.log(config);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- // hooks: {
|
|
|
|
|
- // render: {
|
|
|
|
|
- // route(url, result, context) {
|
|
|
|
|
- // if (context.nuxt.state.deviceType.spider) {
|
|
|
|
|
- // const doc = cheerio.load(result.html);
|
|
|
|
|
- // doc(`body script`).remove();
|
|
|
|
|
- // doc(`head style`).remove();
|
|
|
|
|
- // result.html = doc.html();
|
|
|
|
|
- // }
|
|
|
|
|
- // },
|
|
|
|
|
- // }
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+ router: {
|
|
|
|
|
+ middleware: "initialize"
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|