Unverified Commit b25a9835 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

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
parent f22f8845
...@@ -5,15 +5,17 @@ Use `webpack-bundle-analyzer` in your Next.js project ...@@ -5,15 +5,17 @@ Use `webpack-bundle-analyzer` in your Next.js project
## Installation ## Installation
``` ```
npm install -D @next/bundle-analyzer npm install @next/bundle-analyzer
``` ```
or 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 ### Usage with environment variables
Create a next.config.js (and make sure you have next-bundle-analyzer set up) Create a next.config.js (and make sure you have next-bundle-analyzer set up)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment