forked from yugasun/x-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
54 lines (50 loc) · 1.43 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
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const pkg = require('./package.json');
const prod = process.env.NODE_ENV === 'production';
const buildForGitPage = process.env.GIT_PAGE;
module.exports = {
baseUrl: buildForGitPage ? '/x-chart/' : '/',
runtimeCompiler: true,
configureWebpack: {
optimization: {
minimizer: prod
? [
new UglifyJsPlugin({
uglifyOptions: {
compress: {
drop_console: true,
},
},
}),
]
: [],
},
},
chainWebpack: (config) => {
// modify html-webpack-html configure
config.plugin('html').tap((options) => {
options[0].title = pkg.name;
options[0].template = path.join(__dirname, 'src/template/index.html');
options[0].favicon = path.join(__dirname, 'public/favicon.ico');
if (prod) {
options[0].inject = false;
options[0].template = path.join(
__dirname,
'src/template/index.cache.html',
);
options[0].gitPage = buildForGitPage;
}
return options;
});
// modify url-loader for fonts
config.module.rule('fonts').use('url-loader').loader('url-loader').tap((options) => {
options.limit = 10000;
// modify publicPath for git-pages
options.publicPath = buildForGitPage
? '/x-chart/'
: '/';
return options;
});
},
};