forked from kentcdodds/glamorous-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
52 lines (44 loc) · 1.17 KB
/
next.config.js
File metadata and controls
52 lines (44 loc) · 1.17 KB
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
const webpack = require('webpack')
const marked = require('marked')
const renderer = new marked.Renderer()
const USE_PREFETCH = process.env.NODE_ENV !== 'test'
renderer.heading = (text, level) => {
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-')
return `<h${level}><a name="${escapedText}" href="#${escapedText}">${text}</a></h${level}>`
}
module.exports = {
webpack: config => {
// Add in prefetch conditionally so we don't break jest snapshot testing
config.plugins.push(
new webpack.DefinePlugin({
'process.env.USE_PREFETCH': JSON.stringify(USE_PREFETCH),
})
)
// Markdown loader so we can use docs as .md files
config.module.rules.push({
test: /\.md$/,
use: [
{loader: 'html-loader'},
{loader: 'markdown-loader', options: {pedantic: true, renderer}},
],
})
config.node = config.node || {}
Object.assign(config.node, {
__dirname: true,
__filename: true,
})
return config
},
}
// This is not transpiled
/*
eslint
comma-dangle: [
2,
{
arrays: 'always-multiline',
objects: 'always-multiline',
functions: 'never'
}
]
*/