-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
180 lines (159 loc) · 5.07 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
// import MDX from "@next/mdx";
// const withMDX = MDX({
// extension: /\.(md|mdx)$/,
// options: {
// /* otherOptions… */
// },
// });
/** @type {import('next').NextConfig} */
module.exports = {
// Configure `pageExtensions` to include MDX files
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
images: {
remotePatterns: [
{
protocol: "https",
hostname: "stackoverflow.com",
port: "",
pathname: "/users/flair/**",
},
],
},
// https://nextjs.org/docs/app/api-reference/next-config-js/logging
logging: {
// You can configure the logging level and whether the full URL is logged to the console when running Next.js in development mode.
// Currently, logging only applies to data fetching using the fetch API. It does not yet apply to other logs inside of Next.js.
fetches: {
fullUrl: true,
},
// https://nextjs.org/docs/app/api-reference/next-config-js/onDemandEntries
onDemandEntries: {
// period (in ms) where the server will keep pages in the buffer
maxInactiveAge: 1 * 1000,
// number of pages that should be kept simultaneously without being disposed
pagesBufferLength: 12,
},
},
experimental: {
serverComponentsExternalPackages: ["puppeteer"],
urlImports: [
"https://wakatime.com/badge/user/0ff1bf94-98b4-465f-8b63-a51fb5151092.svg",
"https://img.shields.io/youtube/views/fX5U50VGxtg",
],
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Powered-By",
value: "Anthony Dombrowski",
},
],
},
];
},
// trailingSlash: true,
poweredByHeader: false,
webpack: (config) => {
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) =>
rule.test?.test?.(".svg"),
);
config.module.rules.push(
// Reapply the existing rule, but only for svg imports ending in ?url
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
// Convert all other *.svg imports to React components
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: ["@svgr/webpack"],
},
);
// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;
return config;
},
};
// /** @type {import('next').NextConfig} */
// const nextConfig = {
// // Configure `pageExtensions` to include MDX files
// pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
// images: {
// remotePatterns: [
// {
// protocol: "https",
// hostname: "stackoverflow.com",
// port: "",
// pathname: "/users/flair/**",
// },
// ],
// },
// // https://nextjs.org/docs/app/api-reference/next-config-js/logging
// logging: {
// // You can configure the logging level and whether the full URL is logged to the console when running Next.js in development mode.
// // Currently, logging only applies to data fetching using the fetch API. It does not yet apply to other logs inside of Next.js.
// fetches: {
// fullUrl: true,
// },
// // https://nextjs.org/docs/app/api-reference/next-config-js/onDemandEntries
// onDemandEntries: {
// // period (in ms) where the server will keep pages in the buffer
// maxInactiveAge: 1 * 1000,
// // number of pages that should be kept simultaneously without being disposed
// pagesBufferLength: 12,
// },
// },
// experimental: {
// serverComponentsExternalPackages: ["puppeteer"],
// urlImports: [
// "https://wakatime.com/badge/user/0ff1bf94-98b4-465f-8b63-a51fb5151092.svg",
// ],
// },
// async headers() {
// return [
// {
// source: "/(.*)",
// headers: [
// {
// key: "X-Powered-By",
// value: "Anthony Dombrowski",
// },
// ],
// },
// ];
// },
// // trailingSlash: true,
// poweredByHeader: false,
// webpack: (config) => {
// // Grab the existing rule that handles SVG imports
// const fileLoaderRule = config.module.rules.find((rule) =>
// rule.test?.test?.(".svg"),
// );
// config.module.rules.push(
// // Reapply the existing rule, but only for svg imports ending in ?url
// {
// ...fileLoaderRule,
// test: /\.svg$/i,
// resourceQuery: /url/, // *.svg?url
// },
// // Convert all other *.svg imports to React components
// {
// test: /\.svg$/i,
// issuer: fileLoaderRule.issuer,
// resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
// use: ["@svgr/webpack"],
// },
// );
// // Modify the file loader rule to ignore *.svg, since we have it handled now.
// fileLoaderRule.exclude = /\.svg$/i;
// return config;
// },
// };
// export default nextConfig;