forked from coderplex-org/coderplex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
140 lines (137 loc) · 3.39 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
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
131
132
133
134
135
136
137
138
139
140
const { ANALYZE } = process.env;
// For now copy paste from utils mockdata later we will fetch these from API
// We cannot import from utils/mockData.js because this file is not transpiled so does not support es6 modules
const listOfSubjects = [
{
id: '2132',
title: 'Laravel',
domain: 'Web Development',
url: '/learn/laravel',
subjectId: 'laravel',
icon: 'devicon-laravel-plain colored',
learningCount: '20',
learnGuideStatus: true,
},
{
id: '213',
title: 'ReactJS',
domain: 'Web Development',
url: '/learn/reactjs',
subjectId: 'reactjs',
icon: 'devicon-react-original colored',
learningCount: '28',
learnGuideStatus: false,
},
{
id: '2131',
title: 'Go',
domain: 'Programming Language',
url: '/learn/go',
subjectId: 'go',
icon: 'devicon-go-plain ',
learningCount: '7',
learnGuideStatus: false,
},
{
id: '21fa3',
title: 'Android',
domain: 'Mobile Technology',
url: '/learn/android',
subjectId: 'android',
icon: 'devicon-android-plain colored',
learningCount: '9',
learnGuideStatus: false,
},
{
id: '21afasda3',
title: 'Rails',
domain: 'Backend Development',
url: '/learn/rails',
subjectId: 'rails',
icon: 'devicon-rails-plain colored',
learningCount: '14',
learnGuideStatus: false,
},
{
id: '21wqerwqe3',
title: 'Python',
domain: 'Programming Language',
url: '/learn/python',
subjectId: 'python',
icon: 'devicon-python-plain colored',
learningCount: '32',
learnGuideStatus: false,
},
{
id: '2bxcvbx13',
title: 'iOS',
domain: 'Mobile Technology',
url: '/learn/ios',
subjectId: 'ios',
icon: 'devicon-swift-plain colored',
learningCount: '45',
learnGuideStatus: false,
},
{
id: '2bxczzxcvbx13',
title: 'Javascript',
domain: 'Programming Language',
url: '/learn/javascript',
subjectId: 'javascript',
icon: 'devicon-javascript-plain colored',
learningCount: '31',
learnGuideStatus: false,
},
{
id: '2bxdfasczzxcvbx13',
title: 'Angular',
domain: 'Frontend Development',
url: '/learn/angular',
subjectId: 'angular',
icon: 'devicon-angularjs-plain colored',
learningCount: '3',
learnGuideStatus: false,
},
];
module.exports = {
webpack: (config, { dev }) => {
/* Enable only in Production */
if (!dev) {
// Preact
// console.log('> Using Preact instead of React');
// config.resolve.alias = {
// react: 'preact-compat/dist/preact-compat',
// 'react-dom': 'preact-compat/dist/preact-compat',
// 'react-emotion': 'preact-emotion',
// };
if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true,
})
);
}
}
return config;
},
exportPathMap() {
const routes = {
'/': { page: '/' },
'/events': { page: '/events' },
'/learn': { page: '/learn' },
'/space': { page: '/space' },
'/login': { page: '/login' },
};
for (const subject of listOfSubjects) {
routes[subject.url] = {
page: '/learn/subject',
query: { id: subject.subjectId },
};
}
console.log(routes);
return routes;
},
};