From efec8f02790f1afc81adf99ba6cf50529a6a209f Mon Sep 17 00:00:00 2001 From: cargallo Date: Sun, 16 Aug 2020 12:25:51 -0300 Subject: [PATCH] how to bundle-analyzer with next-compose-plugins (#15370) Added a section in readme with the proper use of the plugin with next-compose-plugins ^2.0.0, otherwise it doesn't work --- packages/next-bundle-analyzer/readme.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/next-bundle-analyzer/readme.md b/packages/next-bundle-analyzer/readme.md index 5ddf2b8f08275d..1436cb23c8030f 100644 --- a/packages/next-bundle-analyzer/readme.md +++ b/packages/next-bundle-analyzer/readme.md @@ -41,3 +41,18 @@ ANALYZE=true yarn build ``` When enabled two HTML files (client.html and server.html) will be outputted to `/analyze/`. One will be for the server bundle, one for the browser bundle. + +### Usage with next-compose-plugins + +From version 2.0.0 of next-compose-plugins you need to call bundle-analyzer in this way to work + +```js +const withPlugins = require('next-compose-plugins') +const withBundleAnalyzer = require('@next/bundle-analyzer')({ + enabled: process.env.ANALYZE === 'true', +}) +module.exports = withPlugins([ + [withBundleAnalyzer({})], + // your other plugins here +]) +```