-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnext.config.js
77 lines (71 loc) · 2.79 KB
/
next.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
/* eslint-disable */
const env = require("./env-config.js")
// Where your antd-custom.less file lives
module.exports = {
env,
trailingSlash: true,
exportPathMap: () => generatePathMap(),
webpack: (config, { isServer }) => {
if (isServer) {
const antStyles = /antd\/.*?\/style.*?/
const origExternals = [...config.externals]
config.externals = [
(context, request, callback) => {
if (request.match(antStyles)) return callback()
if (typeof origExternals[0] === 'function') {
origExternals[0](context, request, callback)
} else {
callback()
}
},
...(typeof origExternals[0] === 'function' ? [] : origExternals),
]
config.module.rules.unshift({
test: antStyles,
use: 'null-loader',
})
}
return config
},
}
///////////////////////////////////////////////////////////////////////////////
// HELPERS
///////////////////////////////////////////////////////////////////////////////
async function generatePathMap() {
const routes = {
public: {
'/': { page: '/' },
'/entities': { page: '/entities' },
'/processes': { page: '/processes' },
'/processes/list': { page: '/processes/list' },
'/processes/vote': { page: '/processes/vote' },
'/processes/login': { page: '/processes/login' },
'/posts': { page: '/posts' },
'/posts/view': { page: '/posts/view' },
'/validation': { page: '/validation' },
},
private: {
'/account/edit': { page: '/account/edit' },
'/account/new': { page: '/account/new' },
'/account/import': { page: '/account/import' },
'/entities/edit': { page: '/entities/edit' },
'/entities/new': { page: '/entities/new' },
'/processes/new': { page: '/processes/new' },
// '/processes/edit': { page: '/processes/edit' },
'/posts/edit': { page: '/posts/edit' },
'/posts/new': { page: '/posts/new' },
'/validation': { page: '/validation' },
'/members': { page: '/members' },
'/members/view': { page: '/members/view' },
'/members/import': { page: '/members/import' },
'/targets': { page: '/targets' },
'/targets/view': { page: '/targets/view' },
'/census': { page: '/census' },
'/census/view': { page: '/census/view' }
},
}
if (env.BOOTNODES_URL_RW && env.BOOTNODES_URL_RW.length > 0) {
return { ...routes.public, ...routes.private }
}
return routes.public
}