-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
31 lines (28 loc) · 811 Bytes
/
next.config.js
File metadata and controls
31 lines (28 loc) · 811 Bytes
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
const withBundleAnalyzer = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
if (process.env.ANALYZE === "true") {
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: options.isServer
? "../analyze/server.html"
: "./analyze/client.html",
})
);
}
if (typeof nextConfig.webpack === "function") {
return nextConfig.webpack(config, options);
}
return config;
},
});
};
const nextConfig = {
env: require("./.env.js"),
images: {
domains: ["cdn.pixabay.com"],
},
};
module.exports = withBundleAnalyzer(nextConfig);