forked from Kwenta/kwenta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
98 lines (91 loc) · 1.97 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
/**
* @type {import('next').NextConfig}
*/
const gitRevision = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
// https://github.com/facebookexperimental/Recoil/issues/733#issuecomment-925072943
const intercept = require('intercept-stdout');
// safely ignore recoil stdout warning messages
function interceptStdout(text) {
if (text.includes('Duplicate atom key')) {
return '';
}
return text;
}
// Intercept in dev and prod
intercept(interceptStdout);
const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');
module.exports = withPlugins([
[
optimizedImages,
{
/* config for next-optimized-images (use default) */
imagesFolder: 'images',
imagePublicPolder: '/_next/static/images',
imageOutputPath: '/static/images',
},
],
{
env: {
GIT_HASH_ID: gitRevision,
},
images: {
disableStaticImages: true,
},
webpack: (config, options) => {
config.resolve.mainFields = ['module', 'browser', 'main'];
config.module.rules.push(
{
test: /\.svg$/,
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: true,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
cleanupIDs: false,
},
},
},
],
},
titleProp: true,
},
},
{
test: /\.png/,
type: 'asset/resource',
}
);
return config;
},
trailingSlash: !!process.env.NEXT_PUBLIC_DISABLE_PRETTY_URLS,
exportPathMap: function (defaultPathMap) {
return {
...defaultPathMap,
'/': {
page: '/',
},
'/dashboard': {
page: '/dashboard/[[...tab]]',
},
'/exchange': {
page: '/exchange/[[...market]]',
},
};
},
compiler: {
// ssr and displayName are configured by default
styledComponents: true,
},
experimental: { images: { layoutRaw: true } },
},
]);