forked from aws-amplify/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
64 lines (56 loc) · 1.97 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
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');
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({
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
})
);
return nextConfig;
};
// eslint-disable-next-line @typescript-eslint/no-var-requires
const generatePathMap = require('./generatePathMap.cjs');
function exportPathMap(defaultPathMap, props) {
return generatePathMap(directory);
}