-
Notifications
You must be signed in to change notification settings - Fork 56
/
next.config.js
38 lines (32 loc) · 1.1 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
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const mapConfig = require('./src/config/maps')
const pages = require('./src/config/pages')
const mapTypes = mapConfig.types.map(i => i.code)
const editorMapRoutes = {}
mapTypes.forEach((mapType) => {
editorMapRoutes[`/editor/${mapType}`] = { page: pages.mapEditor, query: { mapType } }
editorMapRoutes[`/editor/${mapType}/upload`] = { page: pages.upload, query: { mapType } }
editorMapRoutes[`/editor/${mapType}/edit-data`] = { page: pages.editData, query: { mapType } }
editorMapRoutes[`/editor/${mapType}/edit-map`] = { page: pages.editMap, query: { mapType } }
})
module.exports = {
exportPathMap: () => ({
'/': { page: '/' },
'/contact': { page: '/contact' },
'/showcase': { page: '/showcase' },
'/editor': { page: '/editor' },
...editorMapRoutes,
}),
webpack: (config) => {
if (process.env.ANALYZE) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true,
})
)
}
return config
},
}