-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathnext.config.js
25 lines (25 loc) · 1019 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
const withBundleAnalyzer = require("@zeit/next-bundle-analyzer")
// const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer")
const withSass = require('@zeit/next-sass')
const withCSS = require('@zeit/next-css')
const withSourceMaps = require('@zeit/next-source-maps')
const isAnalyze = process.env.BUNDLE_ANALYZE === 'both'
console.log('isAnalyze: ', isAnalyze)
if (isAnalyze) {
module.exports = withBundleAnalyzer({
analyzeServer: ["server", "both"].includes(process.env.BUNDLE_ANALYZE),
analyzeBrowser: ["browser", "both"].includes(process.env.BUNDLE_ANALYZE),
bundleAnalyzerConfig: {
server: {
analyzerMode: 'static',
reportFilename: '../../bundles/server.html'
},
browser: {
analyzerMode: 'static',
reportFilename: '../bundles/client.html'
}
}
}, withSass(withCSS(withSourceMaps())))
} else {
module.exports = withSass(withCSS(withSourceMaps()))
}