-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvue.config.js
65 lines (60 loc) · 1.6 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
const path = require('path');
const PrerenderSPAPlugin = require('prerender-spa-plugin');
// const fs = require('fs');
// const StatsPlugin = require('stats-webpack-plugin');
const plugins = [
// new StatsPlugin('stats.json')
];
if (process.env.VUE_APP_API_URL === 'https://api.coderush.xyz') {
plugins.push(new PrerenderSPAPlugin({
staticDir: path.join(__dirname, 'dist'),
routes: ['/', '/about', '/contribute'],
}));
}
module.exports = {
productionSourceMap: false,
css: {
loaderOptions: {
sass: {
prependData: '\n@import "@/styles/global.sass"\n',
sassOptions: {
indentedSyntax: true,
},
},
},
sourceMap: false,
},
configureWebpack: {
resolve: {
alias: {
// bundle size optimatization
moment: 'moment/src/moment',
'chart.js$': 'chart.js/dist/Chart.min.js',
},
},
plugins,
},
chainWebpack(config) {
config.optimization.minimizer('terser').tap((args) => {
const { terserOptions } = args[0];
terserOptions.compress.drop_console = true;
return args;
});
config.plugin('copy').tap((options) => {
options[0][0].ignore.push('**/material-darker.css');
return options;
});
// config.plugins.delete('prefetch');
},
devServer: {
clientLogLevel: 'info',
headers: {
'Access-Control-Allow-Origin': '*',
},
// https: {
// key: fs.readFileSync(`${process.env.HOME}/localhost.key`),
// cert: fs.readFileSync(`${process.env.HOME}/localhost.crt`),
// ca: fs.readFileSync(`${process.env.HOME}/rootCA.crt`),
// },
},
};