Unverified Commit ea0f5163 authored by Sean O'Neil's avatar Sean O'Neil Committed by GitHub

Update 06-bundle-analyzer.mdx (#64740)

The[ existing code
example](https://nextjs.org/docs/app/building-your-application/optimizing/bundle-analyzer)
generates the following warning when using `--turbo` in the current
latest version of NextJS (14.2.2):

⚠ Webpack is configured while Turbopack is not, which may cause
problems.
 ⚠ See instructions if you need to configure Turbopack:
  https://nextjs.org/docs/app/api-reference/next-config-js/turbo

This modification ensures that the bundle analyzer is only applied when
the user intends to generate a report.

Fixes # https://github.com/vercel/next.js/issues/64739

---------
Co-authored-by: 's avatarLee Robinson <me@leerob.io>
Co-authored-by: 's avatarMaxim Svetlakov <maxim@ebookapplications.com>
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent cf038a33
......@@ -24,14 +24,13 @@ pnpm add @next/bundle-analyzer
Then, add the bundle analyzer's settings to your `next.config.js`.
```js filename="next.config.js"
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = withBundleAnalyzer(nextConfig)
const withBundleAnalyzer = require('@next/bundle-analyzer')()
module.exports =
process.env.ANALYZE === 'true' ? withBundleAnalyzer(nextConfig) : nextConfig
```
## Analyzing your bundles
......
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