-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathnext.config.js
42 lines (38 loc) · 1.11 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
const webpack = require("webpack");
const { parsed: localEnv } = require("dotenv").config();
const withSourceMaps = require("@zeit/next-source-maps");
const withImages = require("next-images");
const withPlugins = require("next-compose-plugins");
const withBundleAnalyzer = require("@zeit/next-bundle-analyzer");
const plugins = [
withSourceMaps,
withImages,
[
withBundleAnalyzer,
{
analyzeServer: ["server", "both"].includes(process.env.BUNDLE_ANALYZE),
analyzeBrowser: ["browser", "both"].includes(process.env.BUNDLE_ANALYZE),
bundleAnalyzerConfig: {
server: {
analyzerMode: "static",
reportFilename: "../server-analyze.html"
},
browser: {
analyzerMode: "static",
reportFilename: "client-analyze.html"
}
}
}
]
];
module.exports = withPlugins([...plugins], {
webpack: (config, { dev, isServer }) => {
const conf = config;
// Fixes npm packages that depend on `fs` module
conf.node = {
fs: "empty"
};
conf.plugins.push(new webpack.EnvironmentPlugin(localEnv));
return conf;
}
});