-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
68 lines (62 loc) · 1.83 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
65
66
67
68
const path = require('path');
const csp = require('./csp');
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
providerImportSource: "@mdx-js/react",
},
})
module.exports = withMDX({
reactStrictMode: true,
productionBrowserSourceMaps: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
webpack: (config, { isServer }) => {
const configCopy = { ...config };
configCopy.resolve.alias = {
...config.resolve.alias,
'@components': path.resolve(__dirname, './src/components/'),
'@icons': path.resolve(__dirname, './src/icons/'),
'@layout': path.resolve(__dirname, './src/layout/'),
'@root': path.resolve(__dirname, './src'),
'@scss': path.resolve(__dirname, './src/scss/'),
// IMPORTANT: the next lines are for development only
// keep them commented out unless actively developing local react modules
// react: path.join(__dirname, "node_modules/react"),
// "react-dom": path.join(__dirname, "node_modules/react-dom"),
// "@faceless-ui/modal": path.resolve(__dirname, "../../faceless-ui/modal"),
// "@faceless-ui/slider": path.resolve(__dirname, "../../faceless-ui/slider"),
};
return configCopy;
},
redirects: async () => ([
{
source: '/docs',
destination: '/docs/getting-started',
permanent: false
}
]),
async headers() {
const headers = [];
headers.push({
source: '/(.*)', // applies to all routes
headers: [
{
key: 'Content-Security-Policy',
value: csp,
}
],
})
if (!process.env.NEXT_PUBLIC_IS_LIVE) {
headers.push({
headers: [{
key: 'X-Robots-Tag',
value: 'noindex',
}],
source: '/:path*',
});
}
return headers;
}
})