forked from DHRI-Curriculum/DHRIFT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
68 lines (63 loc) · 1.81 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const withYAML = require('next-yaml')
const withPlugins = require('next-compose-plugins')
const withMDX = require('@next/mdx')({
extension: /\.(md|mdx)$/,
})
const isGitHub = process.env.GITHUB_ACTIONS === "true";
console.log(`Running in ${isGitHub ? "GitHub Actions" : "local"} mode`);
var repoName;
if (isGitHub) {
repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
}else{
repoName = 'dhrift';
}
console.log(`Repo name: ${repoName}`);
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 imagesConfig = function(build, isGitHub) {
// if (isGitHub) {
// return {
// unoptimized: true,
// // path: '../..',
// }
// }
// else if (build) {
// return {
// unoptimized: true,
// // path: '../..',
// }
// }
// }
const nextConfig = {
output: "export",
trailingSlash: true,
basePath: isGitHub ? '/' + repoName : '',
assetPrefix: isGitHub ? '/' + repoName + '/' : '',
images: {
unoptimized: true,
}
// async headers() {
// return [
// {
// source: '/(.*)',
// headers: [
// {
// key: 'Cross-Origin-Opener-Policy',
// value: 'same-origin',
// },
// {
// key: 'Cross-Origin-Embedder-Policy',
// value: 'require-corp',
// },
// ],
// },
// ]
// }
}
console.log(nextConfig);
module.exports = withPlugins([
[withYAML],
[withMDX],
], nextConfig);