-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
54 lines (50 loc) · 1.49 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
const path = require("path");
const PrerenderSPAPlugin = require("prerender-spa-plugin");
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer;
const { navsFlat } = require("./src/utils/navs");
const categories = {
"/shares": "取得状況",
}
Object.keys(navsFlat).forEach(id => {
if (navsFlat[id].text) {
categories[`/share2/${id}`] = navsFlat[id].text;
}
});
const routes = Object.keys(categories);
module.exports = {
publicPath:
process.env.NODE_ENV === "production" ? "/acnh-gachi-complete/" : "/",
outputDir: "docs",
pages: {
index: {
entry: "src/main.js",
title: "あつ森ガチコンプ",
},
},
configureWebpack: () => {
if (process.env.NODE_ENV === "production") {
return {
plugins: [
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, "docs"),
renderer: new Renderer({
maxConcurrentRoutes: 4,
}),
routes: routes,
postProcess(context) {
context.html = context.html.replace(
/content="【あつ森ガチコンプ】アイテムの取得状況を管理・共有できるウェブアプリ"/g,
`content="${categories[context.route]} | あつ森ガチコンプ"`
);
context.html = context.html.replace(
/<script data-spa="true">(.*?)<\/script>/,
""
);
return context;
},
}),
],
};
}
},
};