forked from ShanghaitechGeekPie/coursebench-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
73 lines (72 loc) · 1.94 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
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const productionGzipExtensions = /\.(js|css|json|md|html|ico)(\?.*)?$/i;
const path = require('path');
const process = require('process');
const fs = require('fs');
module.exports = {
productionSourceMap: false,
chainWebpack: (config) => {
config.plugins.delete('prefetch');
if (process.env.NODE_ENV === 'production') {
config.plugin('compressionPlugin').use(
new CompressionWebpackPlugin({
filename: '[path][base].br',
algorithm: 'brotliCompress',
test: productionGzipExtensions,
compressionOptions: {
level: 11,
},
}),
);
}
},
devServer: {
hot: true,
port: 8000,
compress: true,
},
transpileDependencies: ['vuetify'],
configureWebpack: {
cache: {
type: 'filesystem',
},
resolve: {
alias: {
'@': path.join(__dirname, './src'),
},
},
externals: {
Config: JSON.stringify({
serverUrl: process.env.SERVER,
buildVersion: process.env.BUILD_VERSION,
buildMode: process.env.BUILD_MODE,
}),
Policy: JSON.stringify({
privacyPolicy: fs.readFileSync(
path.join(__dirname, './src/assets/privacy_policy.md'),
'utf8',
),
termsOfService: fs.readFileSync(
path.join(__dirname, './src/assets/terms_of_service.md'),
'utf8',
),
commentPolicy: fs.readFileSync(
path.join(__dirname, './src/assets/comment_policy.md'),
'utf8',
),
benchReviewerPolicy: fs.readFileSync(
path.join(__dirname, './src/assets/bench_reviewer.md'),
'utf8',
),
}),
},
module: {
rules: [
{
test: /\.md$/,
use: ['./src/plugins/markdown-loader'],
},
],
},
},
};