Skip to content

Commit ea0f516

Browse files
sean-rallycryleerobunbelivrijjk
authored
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 # #64739 --------- Co-authored-by: Lee Robinson <[email protected]> Co-authored-by: Maxim Svetlakov <[email protected]> Co-authored-by: JJ Kasper <[email protected]>
1 parent cf038a3 commit ea0f516

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/02-app/01-building-your-application/06-optimizing/06-bundle-analyzer.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ pnpm add @next/bundle-analyzer
2424
Then, add the bundle analyzer's settings to your `next.config.js`.
2525

2626
```js filename="next.config.js"
27-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
28-
enabled: process.env.ANALYZE === 'true',
29-
})
30-
3127
/** @type {import('next').NextConfig} */
3228
const nextConfig = {}
3329

34-
module.exports = withBundleAnalyzer(nextConfig)
30+
const withBundleAnalyzer = require('@next/bundle-analyzer')()
31+
32+
module.exports =
33+
process.env.ANALYZE === 'true' ? withBundleAnalyzer(nextConfig) : nextConfig
3534
```
3635

3736
## Analyzing your bundles

0 commit comments

Comments
 (0)