-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
40 lines (38 loc) · 1.25 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
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.NEXT_ANALYZE === 'true',
});
const withCSS = require('@zeit/next-css');
const withOffline = require('next-offline');
const runtimeCaching = require('./src/lib/cache.js');
const nextConfig = {
workboxOpts: {
swDest: process.env.NEXT_EXPORT === 'true' ? 'service-worker.js' : 'static/service-worker.js',
runtimeCaching,
},
webpack: function (config, { buildId, dev, isServer, defaultLoaders, webpack }) {
config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
name: '[name].[ext]',
},
},
});
config.plugins.push(
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
);
return config;
},
async rewrites() {
return [
{
source: '/service-worker.js',
destination: '/_next/static/service-worker.js',
},
];
},
};
module.exports = withBundleAnalyzer(withOffline(withCSS(nextConfig)));