-
Notifications
You must be signed in to change notification settings - Fork 3
/
next.config.js
74 lines (67 loc) · 1.71 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
const path = require('path');
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
});
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
sassOptions: {
includePaths: [path.join(__dirname, 'styles')]
},
webpack: (config, context) => {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
});
config.module.rules.push({
test: /\.svg$/i,
include: path.join(__dirname, 'icons'),
use: [
{
loader: 'svg-sprite-loader',
options: {
extract: true,
outputPath: 'static/',
publicPath: '_next/static/',
esModule: false
}
}
]
});
config.module.rules.push({
test: /\.svg$/i,
include: path.join(__dirname, 'public', 'logo'),
issuer: /\.[jt]sx?$/,
use: [
{
loader: '@svgr/webpack',
// https://react-svgr.com/docs/options/
options: {
dimensions: false,
prettier: false,
svgo: true,
titleProp: true,
svgoConfig: {
plugins: [
{
name: 'removeViewBox',
active: false
},
{
name: 'prefixIds',
active: false
}
]
}
}
}
]
});
config.plugins.push(new SpriteLoaderPlugin());
return config;
}
};
module.exports = withBundleAnalyzer(nextConfig);