|
|
@@ -1,118 +1,122 @@
|
|
|
const pkg = require('./package');
|
|
|
+const cheerio = require('cheerio')
|
|
|
|
|
|
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'
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
+ 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
|
|
|
- },
|
|
|
-
|
|
|
- /*
|
|
|
+ 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: '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' } ]
|
|
|
- },
|
|
|
-
|
|
|
- /*
|
|
|
+ head: {
|
|
|
+ title: '程序员客栈',
|
|
|
+ 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' },
|
|
|
+ // 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' },
|
|
|
-
|
|
|
- /*
|
|
|
+ loading: { color: '#fff' },
|
|
|
+
|
|
|
+ /*
|
|
|
** Global CSS
|
|
|
*/
|
|
|
- css: [ '@/assets/css/common.css', '@/assets/css/special.css', 'swiper/dist/css/swiper.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: [
|
|
|
+ 'plugins/common',
|
|
|
+ 'plugins/element',
|
|
|
+ // 'plugins/http',
|
|
|
+ 'plugins/nuxtAxios',
|
|
|
'plugins/deviceType',
|
|
|
- {
|
|
|
- src:'plugins/rem',
|
|
|
- ssr: false
|
|
|
- },
|
|
|
- {
|
|
|
- src: "plugins/vue-swiper.js",
|
|
|
- ssr: false
|
|
|
- },
|
|
|
- {
|
|
|
- src: "plugins/g2.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
|
|
|
- },
|
|
|
- /**
|
|
|
+ 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 } ],
|
|
|
- [ '/upload_image', { target: 'https://dev.test-jishuin.proginn.com', changeOrigin: true } ],
|
|
|
- [ '/image', { target: 'https://stacdn.proginn.com', changeOrigin: true } ]
|
|
|
- ],
|
|
|
-
|
|
|
- /*
|
|
|
+ proxy: [
|
|
|
+ [ '/api', { target: 'https://dev.test.proginn.com', changeOrigin: true } ],
|
|
|
+ [ '/file/proxyUpload', { target: 'https://dev.test.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' ],
|
|
|
-
|
|
|
- /*
|
|
|
+ modules: [ '@nuxtjs/axios', '@nuxtjs/proxy' ],
|
|
|
+
|
|
|
+ /*
|
|
|
** Build configuration
|
|
|
*/
|
|
|
- build: {
|
|
|
- /*
|
|
|
+ build: {
|
|
|
+ /*
|
|
|
** You can extend webpack config here
|
|
|
*/
|
|
|
extractCSS: { //提取html中的 css到文件
|
|
|
- allChunks: true,
|
|
|
splitChunks: {
|
|
|
cacheGroups: {
|
|
|
styles: {
|
|
|
@@ -124,8 +128,21 @@ module.exports = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- extend(config, ctx) {
|
|
|
- console.log(config);
|
|
|
- }
|
|
|
- }
|
|
|
+ extend(config, ctx) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
};
|