-
Notifications
You must be signed in to change notification settings - Fork 275
/
Copy pathnext.config.js
61 lines (56 loc) · 1.39 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
const withNextPlugins = require('next-compose-plugins')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const withPWA = require('next-pwa')
const ifdefOpts = {
DEV: process.env.NODE_ENV === 'development',
PROD: process.env.NODE_ENV === 'production',
TEST: process.env.NODE_ENV === 'test',
}
/** @type {import('next').NextConfig} */
module.exports = withNextPlugins([withBundleAnalyzer, withPWA], {
generateBuildId: () => 'build',
eslint: {
dirs: ['pages', 'components', 'config', 'layouts', 'lib', 'utils', 'hooks'],
},
images: {
formats: ['image/avif', 'image/webp'],
domains: ['res.cloudinary.com'],
deviceSizes: [375, 425, 768, 828, 1024, 1440, 1920, 2560],
minimumCacheTTL: 60 * 60 * 24,
},
pwa: {
dest: 'public',
disable: process.env.NODE_ENV !== 'production',
},
webpack: (config) => {
const rules = config.module.rules
// Ifdef loader
rules.push({
test: /\.tsx$/,
use: [
{
loader: 'ifdef-loader',
options: ifdefOpts,
},
],
})
// SVGR loader
rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
icon: true,
svgProps: {
fill: 'currentColor',
},
},
},
],
})
return config
},
})