-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
32 lines (30 loc) · 904 Bytes
/
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
const withPreact = require('next-plugin-preact');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const withPWA = require('next-pwa');
const runtimeCaching = require('next-pwa/cache');
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
images: {
domains: ['rickandmortyapi.com'],
formats: ['image/avif', 'image/webp'],
deviceSizes: [420, 750, 920, 1080],
imageSizes: [420, 750, 920, 1080],
},
pwa: {
disable: process.env.NODE_ENV === 'development',
dest: 'public',
runtimeCaching,
},
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.resolve.fallback = { fs: 'empty' }; // eslint-disable-line no-param-reassign
}
return config;
},
};
module.exports = withBundleAnalyzer(withPWA(withPreact(nextConfig)));