/
vue.config.js
78 lines (73 loc) · 2.33 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
// const url = require('url');
const packageInfos = require('./package.json');
const publicPath = process.env.NODE_ENV === 'production'
? '/the-f2e-challenge-w1/demo/'
: '/';
module.exports = {
outputDir: process.env.NODE_ENV === 'production' ? 'demo' : 'dist',
publicPath,
chainWebpack(config) {
// console.log(config);
config
.plugin('html')
.tap((args) => {
if (process.env.NODE_MODE !== 'development') {
args[0].minify = false;
args[0].meta = {
description: process.env.VUE_APP_SITE_DESC,
keywords: process.env.VUE_APP_SITE_KEYWORDS,
'og:url': {
property: 'og:url',
content: process.env.VUE_APP_SITE_HOST,
},
'og:type': {
property: 'og:type',
content: 'website',
},
'og:title': {
property: 'og:title',
content: process.env.VUE_APP_SITE_TITLE,
},
'og:image': {
property: 'og:image',
content: `${process.env.VUE_APP_SITE_HOST}/img/og-image.jpg?v=${new Date().getTime()}`,
// content: url.resolve(process.env.VUE_APP_SITE_HOST,
// `/img/og-image.jpg?v=${new Date().getTime()}`),
},
'og:image:alt': {
property: 'og:image:alt',
content: process.env.VUE_APP_SITE_DESC,
},
'og:image:width': {
property: 'og:image:width',
content: 1200,
},
'og:image:height': {
property: 'og:image:height',
content: 630,
},
'og:description': {
property: 'og:description',
content: process.env.VUE_APP_SITE_DESC,
},
'og:site_name': {
property: 'og:site_name',
content: process.env.VUE_APP_SITE_TITLE,
},
'og:locale': {
property: 'og:locale',
content: 'zh_TW',
},
};
}
return args;
});
config
.plugin('define')
.tap((args) => {
args[0]['process.env'].VUE_APP_BUILD_VERSION = packageInfos.version;
args[0]['process.env'].VUE_APP_BUILD_TIMESTAMP = `"${new Date().getTime()}"`;
return args;
});
},
};