-
-
Notifications
You must be signed in to change notification settings - Fork 383
/
Copy pathnext.config.js
45 lines (41 loc) · 1.1 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
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const visit = require('unist-util-visit');
const remarkPlugins = require('./src/lib/docs/remark-plugins');
module.exports = {
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
rewrites() {
return [
{
source: '/docs{/}?',
destination: '/docs/overview',
},
];
},
webpack: (config, { dev, isServer, ...options }) => {
config.module.rules.push({
test: /.mdx?$/, // load both .md and .mdx files
use: [
options.defaultLoaders.babel,
{
loader: '@mdx-js/loader',
options: {
remarkPlugins,
},
},
path.join(__dirname, './src/lib/docs/md-loader'),
],
});
if (!dev && isServer) {
// we're in build mode so enable shared caching for the GitHub API
process.env.USE_CACHE = 'true';
const originalEntry = config.entry;
config.entry = async () => {
const entries = { ...(await originalEntry()) };
return entries;
};
}
return config;
},
};