-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
130 lines (121 loc) · 4.13 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
120
121
122
123
124
125
126
127
128
129
130
const path = require("path");
module.exports = {
//❤️ define path for static files ~
publicPath: process.env.NODE_ENV === "development" ? "/" : process.env.STATIC_PATH,
pages: {
index: {
entry: "src/main.js",
template: "public/index.html",
filename: "index.html",
title: "JX3BOX",
},
article: {
title: "Article",
entry: "demo/A.js",
template: "public/article.html",
filename: "article/index.html",
},
tinymce: {
title: "Tinymce",
entry: "demo/T.js",
template: "public/tinymce.html",
filename: "tinymce/index.html",
},
},
//⚛️ Proxy ~
devServer: {
host: "localhost",
proxy: {
"/api/vip": {
target: "https://pay.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
"/api/inspire": {
target: "https://pay.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
"/api/team": {
target: "https://team.api.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
"/api/cms": {
target: process.env["DEV_SERVER"] == "true" ? "http://localhost:7100" : "https://cms.jx3box.com",
},
"/api/article": {
target: "https://next2.jx3box.com",
},
"/api/messages": {
target: "https://helper.jx3box.com",
},
"/api/post/favorite": {
target: "https://helper.jx3box.com",
},
"/api/wiki": {
target: "https://helper.jx3box.com",
},
"/api/personal": {
target: "https://pay.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
"/api/cny": {
target: "https://pay.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
"/api": {
target: "https://next2.jx3box.com",
onProxyReq: function (request) {
request.setHeader("origin", "");
},
},
},
},
//❤️ Webpack configuration
chainWebpack: (config) => {
//💘 html-webpack-plugin ~
// Multiple pages disable the block below
// config.plugin("html").tap((args) => {
// args[0].meta = {
// //------设置SEO信息
// Keywords: setting.keys,
// Description: setting.desc,
// };
// args[0].title = setting.title; //------自动添加标题后缀
// return args;
// });
//💝 in-line small imgs ~
config.module.rule("images").set("parser", {
dataUrlCondition: {
maxSize: 4 * 1024, // 4KiB
},
});
//💝 in-line svg imgs ~
config.module.rule("vue").use("vue-svg-inline-loader").loader("vue-svg-inline-loader");
//💖 import common less var * mixin ~
const types = ["vue-modules", "vue", "normal-modules", "normal"];
types.forEach((type) => addStyleResource(config.module.rule("less").oneOf(type)));
config.externals = {
tinyMCE: "tinyMCE",
}
},
};
function addStyleResource(rule) {
var preload_styles = [];
preload_styles.push(
path.resolve(__dirname, "./node_modules/@jx3box/jx3box-common/css/common.less"),
path.resolve(__dirname, "./node_modules/csslab/base.less"),
path.resolve(__dirname, "./src/assets/css/var.less")
);
rule.use("style-resource").loader("style-resources-loader").options({
patterns: preload_styles,
});
}