-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.ts
47 lines (45 loc) · 1 KB
/
next.config.ts
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
import path from "path";
import type { NextConfig } from "next";
import CopyFilePlugin from "copy-webpack-plugin";
import WriteFilePlugin from "write-file-webpack-plugin";
const config: NextConfig = {
reactStrictMode: true,
redirects: async () => [
{
source: "/:year(\\d{4,})/:month(\\d{2,})/:slug",
destination: "/entries/:slug",
permanent: true,
},
],
headers: async () => [
{
source: "/(.*)",
headers: [
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "Referrer-Policy",
value: "no-referrer-when-downgrade",
},
],
},
],
webpack(config) {
config.plugins.push(
new CopyFilePlugin({
patterns: [
{
context: "content/blog",
from: "**/*.{jpg,png}",
to: path.resolve(__dirname, "public/entries/"),
},
],
}),
new WriteFilePlugin(),
);
return config;
},
};
export default config;