-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
executable file
·37 lines (34 loc) · 1008 Bytes
/
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
const author = require('./config/author-meta.json');
const StatoscopeWebpackPlugin = require('@statoscope/webpack-plugin').default;
/**
* @type {import('next').NextConfig}
*/
module.exports = {
experimental: { esmExternals: 'loose' },
webpack(config, { isServer, dev }) {
if (isServer) {
require('./src/lib/sitemap.js');
}
// analyze client and server the bundle in ANALYZE mode.
if (process.env.ANALYZE === 'true') {
config.plugins.push(
new StatoscopeWebpackPlugin({
saveReportTo: `.next/analyze/report-${isServer ? 'server' : 'client'}.html`,
saveStatsTo: `.next/analyze/stats-${isServer ? 'server' : 'client'}.json`,
})
);
}
return config;
},
async redirects() {
return author.socials.map((social) => {
const source = `/${social.icon}`; // 'name'
const redirect = social.href;
return {
source: source,
destination: redirect,
permanent: true,
};
});
},
};