-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnext.config.js
More file actions
36 lines (31 loc) · 828 Bytes
/
next.config.js
File metadata and controls
36 lines (31 loc) · 828 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
const isGithubActions = process.env.GITHUB_ACTIONS || false;
const isGithubPages = false;
let basePath;
let assetPrefix;
/** We need to set basePath and assetPrefix if hosted on github domain as it will be hosted on {user}.github.io/{repo} */
if (isGithubActions && isGithubPages) {
const repo = process.env.GITHUB_REPOSITORY.replace(/.*?\//, '');
basePath = `/${repo}`;
assetPrefix = `/${repo}/`;
}
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath,
assetPrefix,
reactStrictMode: true,
transpilePackages: ['echarts', 'zrender'],
async redirects() {
return [
{
source: '/posts/:slug',
destination: '/posts',
permanent: true,
},
];
},
images: {
loader: 'imgix',
path: 'https://sws.imgix.net/',
},
};
module.exports = nextConfig;