-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
74 lines (70 loc) · 1.66 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
69
70
71
72
73
74
const withPWA = require("next-pwa");
const withPlugins = require("next-compose-plugins");
const optimizedImages = require("next-optimized-images");
const whitelist = require("./config/whitelist.config");
const NODE_ENV = process.env.NODE_ENV;
const dualENV = {
production: {
PUBLIC_URL: process.env.DEPLOYMENT_BASE_URL
},
development: {
PUBLIC_URL: "http://localhost:3000"
}
};
const env = { ...dualENV[NODE_ENV], isProduction: NODE_ENV === "production" };
module.exports = withPlugins(
[
[
optimizedImages,
{
inlineImageLimit: 8192,
imagesFolder: "images",
imagesName: "[name]-[hash].[ext]",
handleImages: ["jpeg", "png", "webp"],
removeOriginalExtension: false,
optimizeImages: true,
optimizeImagesInDev: false,
mozjpeg: {
quality: 80
},
optipng: {
optimizationLevel: 3
},
pngquant: false,
webp: {
preset: "default",
quality: 75
},
responsive: {
adapter: require("responsive-loader/sharp")
}
}
],
[
withPWA,
{
pwa: {
disable: process.env.NODE_ENV === "development",
register: true,
scope: "/",
sw: "service-worker.js",
dest: "public"
}
}
]
],
{
webpack: (config, { isServer }) => {
if (isServer) {
require("./scripts/sitemap-robots-generator")(env.PUBLIC_URL);
require("./scripts/noflash.minimizer")();
}
config.module.rules.push({
test: /\.md$/,
use: "raw-loader"
});
return config;
},
env
}
);