-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
112 lines (106 loc) · 2.38 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const RobotsTxtPlugin = require('robotstxt-webpack-plugin');
const PrerenderSpaPlugin = require('prerender-spa-plugin');
const SitemapPlugin = require('sitemap-webpack-plugin').default;
const { defineConfig } = require('@vue/cli-service');
const path = require('path');
const webpack = require('webpack');
const fs = require('fs');
const packageJson = fs.readFileSync('./package.json');
const version = JSON.parse(packageJson).version || -1;
const routes = [
'/',
'/blog',
'/cv',
'/blog/case-refactoring-actions-pattern',
'/blog/case-refactoring-sql-queries',
'/blog/howto-write-tickets',
'/blog/data-visualization-vuejs-d3js',
'/blog/jenkins-pipeline-for-frontend-apps',
];
const robotsTxtConfig = {
policy: [
{
userAgent: "Googlebot",
allow: "/",
crawlDelay: 2
},
{
userAgent: "OtherBot",
allow: "/",
crawlDelay: 2
},
{
userAgent: "*",
allow: "/",
crawlDelay: 10,
}
],
sitemap: "http://www.trelobifteki.com/sitemap.xml",
host: "http://www.trelobifteki.com"
};
let plugins = [
/*
new HtmlWebpackPlugin(),
new WebpackCdnPlugin({
modules: [
{
name: 'vue',
var: 'Vue',
path: 'dist/vue.runtime.min.js',
}, {
name: 'vue-router',
var: 'VueRouter',
path: 'dist/vue-router.min.js',
}, {
name: 'vuex',
var: 'Vuex',
path: 'dist/vuex.min.js'
}
],
publicPath: '/node_modules',
}),
*/
new webpack.DefinePlugin({
'process.env': {
PACKAGE_VERSION: '"' + version + '"'
}
})
];
if (process.env.NODE_ENV === 'production') {
plugins = [
...plugins,
new RobotsTxtPlugin(robotsTxtConfig),
new SitemapPlugin({
base: 'https://www.trelobifteki.com',
paths: routes,
options: {
lastmod: true,
changefreq: 'weekly',
},
}),
/*
new PrerenderSpaPlugin({
staticDir: path.join(__dirname, 'dist'),
renderAfterTime: 5000,
routes,
}),
*/
];
}
module.exports = defineConfig({
transpileDependencies: true,
productionSourceMap: false,
configureWebpack: {
plugins,
},
chainWebpack: config => {
config.module.rule('markdown')
.test(/.md$/)
.use([
'html-loader',
'markdown-loader'
])
.loader('markdown-loader')
.end();
},
});