-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.mjs
More file actions
82 lines (75 loc) · 1.77 KB
/
next.config.mjs
File metadata and controls
82 lines (75 loc) · 1.77 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const isPR = process.env.GITHUB_EVENT_NAME === "pull_request";
const prNumber = process.env.GITHUB_EVENT_NUMBER;
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: "export",
...(isPR && {
assetPrefix: `/pr-${prNumber}`,
}),
images: {
remotePatterns: [
{
protocol: "https",
hostname: "codeit-server.s3.ap-northeast-2.amazonaws.com",
port: "",
pathname: "/**",
},
],
unoptimized: true,
},
webpack(config) {
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg"));
config.module.rules.push(
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/,
},
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] },
use: [
{
loader: "@svgr/webpack",
options: {
svgoConfig: {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
},
},
],
},
);
fileLoaderRule.exclude = /\.svg$/i;
config.module.rules.push({
test: /\.(?:woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
generator: {
filename: "static/fonts/[name][ext]",
},
});
return config;
},
experimental: {
turbo: {
rules: {
"*.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
},
};
export default nextConfig;