forked from Michigan-Tech-Courses/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
60 lines (54 loc) · 1.3 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
/* eslint-disable camelcase */
const withPlugins = require('next-compose-plugins');
const withPWA = require('next-pwa');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
module.exports = withPlugins([
[withBundleAnalyzer],
[withPWA, {
pwa: {
dest: 'public',
disable: process.env.NODE_ENV !== 'production',
dynamicStartUrl: false,
register: false,
skipWaiting: false,
buildExcludes: [/middleware-manifest.json$/],
},
}],
], {
productionBrowserSourceMaps: true,
webpack: config => {
config.module.rules.push(
{
test: /react-spring/,
sideEffects: true,
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
);
if (process.env.PROFILE === 'true') {
config.resolve.alias = {
...config.resolve.alias,
'react-dom$': 'react-dom/profiling',
'scheduler/tracing': 'scheduler/tracing-profiling',
};
const terser = config.optimization.minimizer.find(plugin => plugin.options && plugin.options.terserOptions);
if (terser) {
terser.options.terserOptions = {
...terser.options.terserOptions,
keep_classnames: true,
keep_fnames: true,
};
}
}
config.resolve.fallback = {
fs: false,
path: false,
process: require.resolve('process/browser'),
};
return config;
},
});