-
Notifications
You must be signed in to change notification settings - Fork 8
/
next.config.js
68 lines (63 loc) · 1.79 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
const withPlugins = require('next-compose-plugins');
const css = require('@zeit/next-css');
const OptimizedImages = require('next-optimized-images');
const withSourceMaps = require( '@zeit/next-source-maps' );
const withOffline = require('next-offline');
const withBundleAnalyzer = require('@next/bundle-analyzer');
const withYaml = require('next-plugin-yaml');
const customConfig = {
// for turning of dev indicators
devIndicators: {
autoPrerender: false,
},
//minify
// webpack: (config, options) => {
// // config.plugins = config.plugins.filter(
// // (plugin) => (plugin.constructor.name !== 'UglifyJsPlugin')
// // ),
// config.optimization.minimize = true;
// return config
// },
// used for developing inside docker container
webpackDevMiddleware: config => {
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300,
};
return config
},
generateInDevMode: true,
workboxOpts: {
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'offlineCache',
expiration: {
maxEntries: 200,
},
},
},
{
urlPattern: /.png$/,
handler: 'CacheFirst'
},
{
urlPattern: /.jpg$/,
handler: 'CacheFirst'
},
],
},
};
module.exports = withPlugins([
[withSourceMaps],
[withOffline],
[css],
[withYaml],
[withBundleAnalyzer, {
enabled: true,
}],
[OptimizedImages],
], customConfig);