forked from aws-amplify/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
94 lines (85 loc) · 2.8 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const withTM = require('next-transpile-modules')([
'@algolia/autocomplete-shared'
]); // pass the modules you would like to see transpiled
const mdxRenderer = `
import { mdx } from "@mdx-js/react";
`;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const directory = require('./src/directory/directory.js');
require('dotenv').config({ path: './.env.custom' });
module.exports = async (phase, { defaultConfig }) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const headingLinkPlugin = await require('./src/plugins/headings.tsx');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pagePlugin = await require('./src/plugins/page.tsx');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const internalLinkPlugin = await require('./src/plugins/internal-link.tsx');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const codeBlockPlugin = await require('./src/plugins/code-block.tsx');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const importPlugin = await require('./src/plugins/import.tsx');
const withMDX = require('@next/mdx')({
extension: /\.mdx$/,
options: {
remarkPlugins: [
importPlugin,
headingLinkPlugin,
pagePlugin,
internalLinkPlugin
],
rehypePlugins: [codeBlockPlugin],
renderer: mdxRenderer
}
});
const nextConfig = withTM(
withMDX({
env: {
API_ENV: process.env.API_ENV
},
pageExtensions: ['js', 'jsx', 'mdx', 'tsx', 'ts'],
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true
},
future: {
webpack5: true
},
exportPathMap,
trailingSlash: true,
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/(.*)',
headers: [
// IMPORTANT:
// These are ONLY used for the Dev server and MUST
// be kept in sync with customHttp.yml
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains'
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
}
]
}
];
}
})
);
return nextConfig;
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
const generatePathMap = require('./generatePathMap.cjs');
function exportPathMap(defaultPathMap, props) {
return generatePathMap(directory);
}