-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
119 lines (106 loc) · 3.54 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
const path = require("path");
const fs = require("fs");
const packageJson = fs.readFileSync("./package.json");
const version = JSON.parse(packageJson).version || "no version";
const webpack = require("webpack");
const WorkerPlugin = require("worker-plugin");
const BEIAN_CODE = "";
let title = "Genshin Artifact Optimizer";
if ("MONA_TITLE" in process.env) {
title = process.env.MONA_TITLE;
}
let needBeian = true;
if ("MONA_NEED_BEIAN" in process.env) {
needBeian = !!eval(process.env.MONA_NEED_BEIAN);
}
let beianNumber = "1";
if ("MONA_BEIAN_NUMBER" in process.env) {
beianNumber = process.env.MONA_BEIAN_NUMBER;
}
let needMigrate = false;
if ("MONA_NEED_MIGRATE" in process.env) {
needMigrate = !!eval(process.env.MONA_NEED_MIGRATE);
}
let routeMode = "hash";
if ("MONA_ROUTE_MODE" in process.env) {
routeMode = process.env.MONA_ROUTE_MODE;
}
console.info(`
building with:
title = ${title}
needBeian = ${needBeian}
beianNumber = ${beianNumber}
needMigrate = ${needMigrate}
routeMode = ${routeMode}
`);
let now = new Date();
let buildDate = now.toString();
module.exports = {
publicPath: process.env.PublicPath || '/',
configureWebpack: {
resolve: {
alias: {
"@c": path.resolve(__dirname, "src/components"),
"@asset": path.resolve(__dirname, "src/assets"),
"@util": path.resolve(__dirname, "src/utils"),
"@alg": path.resolve(__dirname, "src/algorithms"),
"@page": path.resolve(__dirname, "src/pages"),
"@worker": path.resolve(__dirname, "src/workers"),
"@const": path.resolve(__dirname, "src/constants"),
"@enemy": path.resolve(__dirname, "src/enemies"),
// "genshin_panel": path.resolve(__dirname, "../../ts/genshin/dist"),
}
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
VERSION: `"${version}"`,
WEB_TITLE: `"${title}"`,
NEED_BEIAN: `${needBeian}`,
BEIAN_NUMBER: `"${BEIAN_CODE + '-' + beianNumber}"`,
NEED_MIGRATE: `${needMigrate}`,
ROUTE_MODE: `"${routeMode}"`,
BUILD_DATE: `"${buildDate}"`,
}
}),
new WorkerPlugin({
globalObject: "self",
}),
],
// entry: {
// "compute-worker": "./src/workers/compute.worker.js",
// "potential-worker": "./src/workers/compute_potential.worker.js",
// },
// module: {
// rules: [
// {
// test: /\.worker\.js$/,
// use: [
// {
// loader: "worker-loader",
// // options: {
// // filename: "js/[contenthash].[name].js",
// // }
// },
// // "babel-loader"
// ],
// }
// ]
// },
externals: {
vue: "Vue",
"vue-router": "VueRouter",
vuex: "Vuex",
"element-ui": "ELEMENT",
"vue-echarts": "VueECharts",
}
},
// chainWebpack: config => {
// config.module
// .rule("worker")
// .test(/\.worker\.js$/)
// .use("babel")
// .loader("babel-loader")
// },
productionSourceMap: false,
}