Rocky_Mountain_Vending/.pnpm-store/v10/files/1b/14dda6199e5dd2fb272e66fd94b01c1d1733f64d67b404ea341fc41f83d39abbb8076334052d7fe08d6bef10f401ab81dfec5f1dfe49f175bdad2dc77b66f8
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

73 lines
1.7 KiB
Text

# Next.js + Webpack Bundle Analyzer
Use `webpack-bundle-analyzer` in your Next.js project
## Installation
```
npm install @next/bundle-analyzer
```
or
```
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)
```js
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
module.exports = withBundleAnalyzer({})
```
Or configuration as a function:
```js
module.exports = (phase, defaultConfig) => {
return withBundleAnalyzer(defaultConfig)
}
```
Then you can run the command below:
```bash
# Analyze is done on build when env var is set
ANALYZE=true yarn build
```
When enabled three HTML files (client.html, edge.html and nodejs.html) will be outputted to `<distDir>/analyze/`. One will be for the nodejs server bundle, one for the edge server bundle, and one for the browser bundle.
#### Options
To disable automatically opening the report in your default browser, set `openAnalyzer` to false:
```js
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
openAnalyzer: false,
})
module.exports = withBundleAnalyzer({})
```
### 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
])
```