-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.js
More file actions
39 lines (37 loc) · 961 Bytes
/
next.config.js
File metadata and controls
39 lines (37 loc) · 961 Bytes
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
const { resolve } = require('path');
const needRedirectPostList = [
'react-code-style-guide',
'css-in-react',
'webpack-auto-css-modules',
'how-to-write-great-react',
'dva.js-get-started',
'koa2-get-started',
];
/** @type {import('next').NextConfig} */
module.exports = {
webpack: function (config) {
config.module.rules.push({
test: /\.ya?ml$/,
use: 'js-yaml-loader',
});
return config;
},
async redirects() {
return [
...needRedirectPostList.map((slug) => ({
source: `/${slug}`,
destination: `/post/${slug}`,
permanent: true,
})),
{
source: '/post/:path*',
destination: '/blog/:path*',
permanent: true,
},
];
},
images: {
formats: ['image/avif', 'image/webp'],
domains: ['i0.hdslb.com', 'rmt.ladydaily.com', 'dogefs.s3.ladydaily.com', 'article.biliimg.com', 'cdn.jsdelivr.net', 'npm.elemecdn.com', 'cdn.nlark.com'],
},
};