-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
42 lines (35 loc) · 926 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
33
34
35
36
37
38
39
40
41
42
const withImages = require("next-images");
const dotEnv = require("dotenv");
const prod = process.env.NODE_ENV === "production";
if (!prod) {
dotEnv.config();
}
const base = withImages({
env: {
BASE_URL: process.env.BASE_URL,
MONGODB: process.env.MONGODB,
JWTSECRET: process.env.JWTSECRET,
},
build: {
env: {
BASE_URL: process.env.BASE_URL,
MONGODB: process.env.MONGODB,
JWTSECRET: process.env.JWTSECRET,
},
},
webpack: (config, { dev }) => {
if (dev) {
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
config.plugins.push(new CaseSensitivePathsPlugin());
}
return config;
},
});
if (process.env.ANALYZE || process.env.ANALYZE === "true") {
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: true,
});
module.exports = withBundleAnalyzer(base);
} else {
module.exports = base;
}