Last active
December 6, 2019 04:22
-
-
Save qrg/4407d358a985f4a71c2a9ef6c29cf58c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/zeit/next.js/blob/42cff0a09c4ae42016500b1797ae4f0bd8438e88/packages/next-bundle-analyzer/index.js | |
module.exports = ({ enabled = true } = {}) => (nextConfig = {}) => { | |
return Object.assign({}, nextConfig, { | |
webpack (config, options) { | |
if (enabled) { | |
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 | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment