forked from fullstacksjs/fullstacksjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
65 lines (58 loc) · 1.37 KB
/
next.config.mjs
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
import createNextIntlPlugin from 'next-intl/plugin';
const withNextIntl = createNextIntlPlugin();
const secondsInDay = 60 * 60 * 24;
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
// swcPlugins: [['@swc-jotai/react-refresh', {}]], <- Enable when turbopack is ready
ppr: true,
useCache: true,
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
},
{
protocol: 'https',
hostname: 'www.datocms-assets.com',
},
{
protocol: 'https',
hostname: 'wakatime.com',
pathname: '/photo/**',
},
{
protocol: 'https',
hostname: 'raw.githubusercontent.com',
pathname: '/Tarikul-Islam-Anik/**',
},
],
minimumCacheTTL: secondsInDay,
},
webpack(config) {
addSvgr(config);
return config;
},
};
function addSvgr(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: { not: /\.(css|scss|sass)$/ },
resourceQuery: { not: /url/ },
loader: '@svgr/webpack',
},
);
fileLoaderRule.exclude = /\.svg$/i;
}
export default withNextIntl(nextConfig);