-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
80 lines (72 loc) · 2.11 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
const gitRevision = require("./build/git-revision")();
const path = require("path");
const minimist = require("minimist");
let publicPath = "/";
// GitHub pages
if (process.env.RELEASE_TYPE === "gh-pages") {
publicPath = "/explorer/";
}
// Parse command line arguments
const args = {};
args.host = process.env.HOST;
args.port = Number(process.env.PORT);
args.baseUrl = minimist(process.argv.slice(2)).base || "/";
args.network = minimist(process.argv.slice(2)).network || "mainnet";
args.networkConfig = require(path.resolve(__dirname, `networks/${args.network}.json`));
args.routerMode = minimist(process.argv.slice(2)).history ? "history" : "hash";
const argsPrint = [];
for (const argKey in args) {
const argValue = args[argKey];
if (typeof argValue === "object") {
continue;
}
argsPrint.push(`${argKey}: '${argValue || "-"}'`);
}
// Set proper ENV variables
process.env["VUE_APP_EXPLORER_CONFIG"] = args.network;
process.env["VUE_APP_ROUTER_MODE"] = args.routerMode;
process.env["VUE_APP_TITLE"] = args.networkConfig.title;
process.env["VUE_APP_GIT_VERSION"] = gitRevision.version;
process.env["VUE_APP_GIT_DATE"] = gitRevision.date;
module.exports = {
publicPath,
lintOnSave: false,
runtimeCompiler: true,
pluginOptions: {
i18n: {
locale: "en-GB",
fallbackLocale: "en-GB",
localeDir: "locales",
enableInSFC: true,
},
svgSprite: {
/*
* The directory containing your SVG files.
*/
dir: "src/assets/images/svg",
/*
* The reqex that will be used for the Webpack rule.
*/
test: /\.(svg)(\?.*)?$/,
/*
* @see https://github.com/kisenka/svg-sprite-loader#configuration
*/
loaderOptions: {
extract: true,
spriteFilename: "img/svg.[hash:8].svg", // or 'img/icons.svg' if filenameHashing == false
},
/*
* @see https://github.com/kisenka/svg-sprite-loader#configuration
*/
pluginOptions: {
plainSprite: true,
},
},
},
chainWebpack: config => {
config.module
.rule("svg-sprite")
.use("svgo-loader")
.loader("svgo-loader");
},
};