-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnext.config.js
78 lines (74 loc) · 1.99 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
69
70
71
72
73
74
75
76
77
78
var path = require("path");
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
instrumentationHook: true,
},
reactStrictMode: true,
swcMinify: true,
rewrites: async () => ({
beforeFiles: [
{
source: '/previews/:path*',
destination: '/reviewed-preprints/:path*',
},
{
source: '/:msid(\\d+v{0,1}\\d*)',
destination: '/reviewed-preprints/:msid',
},
{
source: '/reviewed-preprints/_next/:path*',
destination: '/_next/:path*',
},
{
source: '/reviewed-preprints/:path((?!\\d+v{0,1}\\d*))',
destination: '/:path*',
},
{
// Expose path for manuscript bibtex download
source: '/reviewed-preprints/:msid(\\d+v{0,1}\\d*).bib',
destination: '/api/citations/:msid/bibtex',
},
{
// Expose path for manuscript ris download
source: '/reviewed-preprints/:msid(\\d+v{0,1}\\d*).ris',
destination: '/api/citations/:msid/ris',
},
{
source: '/ping',
destination: '/api/ping',
},
{
source: '/status',
destination: '/api/status',
},
{
source: '/robots.txt',
destination: '/api/robots'
}
],
fallback: [
{
source: '/reviewed-preprints/:path*',
destination: '/reviewed-preprints/:path*/fulltext',
},
]
}),
pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js'],
assetPrefix: '/reviewed-preprints',
webpack: (config) => {
config.resolve.fallback = { fs: false };
// This removes the modular CSS requirement, allowing us to use regular SCSS imports in components
config.module.rules.forEach((rule) => {
const { oneOf } = rule;
if (oneOf) {
oneOf.forEach((one) => {
if (!`${one.issuer?.and}`.includes('_app')) return;
one.issuer.and = [path.resolve(__dirname)];
});
}
});
return config;
},
}
module.exports = nextConfig