From b25a983556975f6c9def1daaa325c26af8799d76 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 26 Jul 2021 11:43:07 -0500 Subject: [PATCH] Update bundle analyzer readme (#27507) Follow-up to https://github.com/vercel/next.js/pull/27463 this adds a note about installing as `devDependency` instead of changing the default install command as the plugin being a `devDependency` might cause issues unless wrapped in a `process.env` check. ## Documentation / Examples - [x] Make sure the linting passes --- packages/next-bundle-analyzer/readme.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/next-bundle-analyzer/readme.md b/packages/next-bundle-analyzer/readme.md index 2f053931c5d1d..066b0b8e59033 100644 --- a/packages/next-bundle-analyzer/readme.md +++ b/packages/next-bundle-analyzer/readme.md @@ -5,15 +5,17 @@ Use `webpack-bundle-analyzer` in your Next.js project ## Installation ``` -npm install -D @next/bundle-analyzer +npm install @next/bundle-analyzer ``` or ``` -yarn add --dev @next/bundle-analyzer +yarn add @next/bundle-analyzer ``` +Note: if installing as a `devDependency` make sure to wrap the require in a `process.env` check as `next.config.js` is loaded during `next start` as well. + ### Usage with environment variables Create a next.config.js (and make sure you have next-bundle-analyzer set up)