forked from alexpate/docs
/
next.config.js
32 lines (27 loc) · 762 Bytes
/
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
const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
PHASE_EXPORT
} = require('next/constants')
module.exports = phase => {
const config = {
// Allow mdx and md files to be pages
pageExtensions: ['jsx', 'js', 'mdx', 'md'],
assetPrefix:
phase === PHASE_EXPORT && process.env.NOW_GITHUB_COMMIT_REF === 'master'
? 'https://docs.zeit.sh'
: ''
}
// This makes sure we only require build-time plugins at build time
if (phase !== PHASE_DEVELOPMENT_SERVER && phase !== PHASE_PRODUCTION_BUILD) {
return config
}
// Adds github.com/mdx-js/mdx to Next.js
const withMDX = require('@zeit/next-mdx')({
extension: /\.(md|mdx)?$/,
options: {
hastPlugins: []
}
})
return withMDX(config)
}