-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
99 lines (99 loc) · 3.18 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const imageminMozjpeg = require('imagemin-mozjpeg');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const UglifyJS = require('uglify-es');
const env_vars = require('./ENV_VARS');
const allowedConnections = require('./connections');
const sourceMapsConfig = {
filename: 'sourcemaps/[file].map'
};
if (JSON.parse(env_vars.FULL_SOURCEMAPS) === 'false')
sourceMapsConfig.exclude = /vendors.*.*/;
const webpackConfig = {
devtool: false,
node: {
process: true
},
devServer: {
https: true,
host: 'localhost',
hotOnly: true,
port: 8080,
headers: {
'Strict-Transport-Security':
'max-age=63072000; includeSubdomains; preload',
'Content-Security-Policy':
"font-src 'self' data: js.intercomcdn.com:443; media-src js.intercomcdn.com:443 'self'; default-src 'self' blob:; frame-src 'self' www.walletlink.org:443 connect.trezor.io:443 intercom-sheets.com:443; img-src 'self' downloads.intercomcdn.com:443 gifs.intercomcdn.com:443 js.intercomcdn.com:443 images.ctfassets.net static.intercomassets.com:443 nft.mewapi.io:443 mewcard.mewapi.io:443 img.mewapi.io:443 data: blob: ; script-src 'unsafe-eval' 'unsafe-inline' blob: https:; style-src 'self' 'unsafe-inline' https:; object-src 'none'; connect-src " +
allowedConnections.join(' ') +
';',
'X-Content-Type-Options': 'nosniff',
'X-Frame-Options': 'DENY',
'X-XSS-Protection': '1; mode=block',
'Referrer-Policy': 'same-origin'
}
},
plugins: [
new webpack.SourceMapDevToolPlugin(sourceMapsConfig),
new webpack.NormalModuleReplacementPlugin(/^any-promise$/, 'bluebird'),
new ImageminPlugin({
disable: process.env.NODE_ENV !== 'production',
test: /\.(jpe?g|png|gif|svg)$/i,
pngquant: {
quality: '100'
},
plugins: [
imageminMozjpeg({
quality: 100,
progressive: true
})
]
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'security.txt', to: '.well-known/security.txt' },
{
from: 'public',
transform: function (content, filePath) {
if (filePath.split('.').pop() === ('js' || 'JS'))
return UglifyJS.minify(content.toString()).code;
return content;
}
}
]
}),
new webpack.DefinePlugin(env_vars)
],
optimization: {
splitChunks: {
minSize: 1000000,
maxSize: 20000000
}
}
};
const exportObj = {
publicPath: process.env.ROUTER_MODE === 'history' ? '/' : './',
configureWebpack: webpackConfig,
lintOnSave: process.env.NODE_ENV === 'production' ? 'error' : true,
integrity: process.env.WEBPACK_INTEGRITY === 'false' ? false : true,
pwa: {
name: 'MyEtherWallet',
workboxOptions: {
importWorkboxFrom: 'local',
skipWaiting: true,
clientsClaim: true,
navigateFallback: '/index.html'
}
},
chainWebpack: config => {
2;
// GraphQL Loader
config.module
.rule('graphql')
.test(/\.graphql$/)
.use('graphql-tag/loader')
.loader('graphql-tag/loader')
.end();
}
};
module.exports = exportObj;