-
Notifications
You must be signed in to change notification settings - Fork 32
/
vue.config.js
66 lines (65 loc) · 1.62 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
const fs = require('fs');
const yaml = require('yaml');
const BASE_URL = process.env.DP_BASE_URL || '/';
const HTTPS_KEY = process.env.DP_HTTPS_KEY || false;
const HTTPS_CERT = process.env.DP_HTTPS_CERT || false;
const HTTPS = HTTPS_CERT &&
HTTPS_KEY && {
key: fs.readFileSync(HTTPS_KEY),
cert: fs.readFileSync(HTTPS_CERT),
};
module.exports = {
lintOnSave: false,
productionSourceMap: false,
filenameHashing: true,
publicPath: BASE_URL,
chainWebpack: (config) => {
const svgRule = config.module.rule('svg');
svgRule
.use('image-webpack-loader')
.loader('image-webpack-loader')
.tap(() => {
return {
svgo: {
plugins: [],
},
};
})
.end();
},
configureWebpack: {
resolve: {
// .mjs needed for https://github.com/graphql/graphql-js/issues/1272
extensions: ['*', '.mjs', '.js', '.vue', '.json', '.gql', '.graphql'],
},
module: {
rules: [
// fixes https://github.com/graphql/graphql-js/issues/1272
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{
test: /\.ftl$/,
use: 'raw-loader',
},
],
},
},
devServer: {
https: HTTPS,
host: 'localhost',
port: 8080,
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
before(app) {
app.get('/config/features.json', (_, res) => {
res.append('Access-Control-Allow-Origin', '*');
res.json(yaml.parse(fs.readFileSync('./features-local.yaml', 'utf8')));
});
},
},
};