forked from szweibel/javascripting-graduate-student-old
-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
43 lines (39 loc) · 1.14 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
const withYAML = require('next-yaml')
const withPlugins = require('next-compose-plugins')
const withMDX = require('@next/mdx')({
extension: /\.(md|mdx)$/,
})
const repoName = 'Dhrift-GC'
const build = process.env.NODE_ENV === "production";
console.log(`Running in ${process.env.NODE_ENV} mode`);
process.env.NEXT_PUBLIC_REPO_NAME = repoName
process.env.NEXT_PUBLIC_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS || false;
const isGitHub = process.env.GITHUB_ACTIONS === "true";
console.log(`Running in ${isGitHub ? "GitHub Actions" : "local"} mode`);
const imagesConfig = function(build, isGitHub) {
if (isGitHub) {
return {
loader: 'akamai',
path: '/' + repoName,
}
}
else if (build) {
return {
loader: 'akamai',
path: '../..',
}
}
}
const nextConfig = {
// reactStrictMode: true,
trailingSlash: true,
basePath: isGitHub ? '/' + repoName : '',
assetPrefix: isGitHub ? '/' + repoName + '/' : '',
images: imagesConfig(build, isGitHub),
}
console.log(nextConfig);
module.exports = withPlugins([
[withMDX],
[withYAML],
],
nextConfig)