-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
49 lines (44 loc) · 1.32 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
require("dotenv").config();
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
const withBundleAnalyzer = require("@next/bundle-analyzer");
const path = require("path");
// const withPWA = require("next-pwa");
const nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
webpack: (config, options) => {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: "empty",
};
return config;
},
onDemandEntries: {
// period (in ms) where the server will keep pages in the buffer
maxInactiveAge: 60 * 1000 * 3,
// number of pages that should be kept simultaneously without being disposed
pagesBufferLength: 5,
},
};
const exportByEnv =
process.env.NODE_ENV === "development"
? withPlugins(
[[withImages, { exclude: path.resolve(__dirname, "src/assets/svg") }]],
nextConfig
)
: withPlugins(
[
// [withPWA, { pwa: { dest: "public" } }],
[
withBundleAnalyzer,
{
enabled: process.env.ANALYZE === "true",
},
],
[withImages, { exclude: path.resolve(__dirname, "src/assets/svg") }],
],
nextConfig
);
module.exports = exportByEnv;
// https://leerob.io/blog/learning-css-animations-by-example