-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Expand file tree
/
Copy pathnext.config.js
More file actions
66 lines (63 loc) · 1.8 KB
/
next.config.js
File metadata and controls
66 lines (63 loc) · 1.8 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
/**
* @type {import('next').NextConfig}
**/
const nextConfig = {
turbopack: {
resolveAlias: {
// Don't bundle the shim unnecessarily.
'use-sync-external-store/shim': 'react',
// ESLint depends on the CommonJS version of esquery,
// but Webpack loads the ESM version by default. This
// alias ensures the correct version is used.
//
// More info:
// https://github.com/reactjs/react.dev/pull/8115
esquery: 'esquery/dist/esquery.min.js',
// Replace transitive dependencies with lightweight shims.
raf: './src/utils/rafShim.js',
process: './src/utils/processShim.js',
},
},
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
reactStrictMode: true,
experimental: {
scrollRestoration: true,
turbopackImportTypeText: true,
},
reactCompiler: true,
async rewrites() {
return {
beforeFiles: [
// Serve markdown when Accept header prefers text/markdown
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
{
source: '/:path((?!llms.txt).*)',
has: [
{
type: 'header',
key: 'accept',
value: '(.*text/markdown.*)',
},
],
destination: '/api/md/:path*',
},
// Explicit .md extension also serves markdown
{
source: '/:path*.md',
destination: '/api/md/:path*',
},
],
};
},
env: {},
};
module.exports = nextConfig;