Unverified Commit bfeedb07 authored by Delba de Oliveira's avatar Delba de Oliveira Committed by GitHub

Guide: Update `Optimizing Package Bundling` to include new Bundle Analyzer (#87246)

This PR adds instructions on how to run and navigate the new turbopack
bundle analyzer to the existing [Optimizing package bundling guide
](https://nextjs.org/docs/app/guides/package-bundling).
Todo: 
- [x] Embed video
- [x] Add image for import chain

---------
Co-authored-by: 's avatarLuke Sandberg <lukesandberg@users.noreply.github.com>
Co-authored-by: 's avatargraphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
Co-authored-by: 's avatarRich Haines <hello@richardhaines.dev>
Co-authored-by: 's avatarvercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
parent c02a04d9
...@@ -328,7 +328,7 @@ function HoverPrefetchLink({ href, children }) { ...@@ -328,7 +328,7 @@ function HoverPrefetchLink({ href, children }) {
React mitigates this with Selective Hydration and you can further improve this by: React mitigates this with Selective Hydration and you can further improve this by:
- Using the [`@next/bundle-analyzer`](/docs/app/guides/package-bundling#analyzing-javascript-bundles) plugin to identify and reduce bundle size by removing large dependencies. - Using the [`@next/bundle-analyzer`](/docs/app/guides/package-bundling#nextbundle-analyzer-for-webpack) plugin to identify and reduce bundle size by removing large dependencies.
- Moving logic from the client to the server where possible. See the [Server and Client Components](/docs/app/getting-started/server-and-client-components) docs for guidance. - Moving logic from the client to the server where possible. See the [Server and Client Components](/docs/app/getting-started/server-and-client-components) docs for guidance.
## Examples ## Examples
......
This diff is collapsed.
...@@ -142,7 +142,7 @@ Before going to production, you can run `next build` to build your application l ...@@ -142,7 +142,7 @@ Before going to production, you can run `next build` to build your application l
### Analyzing bundles ### Analyzing bundles
Use the [`@next/bundle-analyzer` plugin](/docs/app/guides/package-bundling#analyzing-javascript-bundles) to analyze the size of your JavaScript bundles and identify large modules and dependencies that might be impacting your application's performance. Use the [`@next/bundle-analyzer` plugin](/docs/app/guides/package-bundling#nextbundle-analyzer-for-webpack) to analyze the size of your JavaScript bundles and identify large modules and dependencies that might be impacting your application's performance.
Additionally, the following tools can help you understand the impact of adding new dependencies to your application: Additionally, the following tools can help you understand the impact of adding new dependencies to your application:
......
--- ---
title: optimizePackageImports title: optimizePackageImports
description: API Reference for optimizePackageImports Next.js Config Option description: API Reference for optimizePackageImports Next.js Config Option
version: experimental
--- ---
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */} {/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
......
...@@ -215,7 +215,7 @@ By default, the command starts a local server after analysis completes, allowing ...@@ -215,7 +215,7 @@ By default, the command starts a local server after analysis completes, allowing
- View the full import chain showing why a module is included - View the full import chain showing why a module is included
- Trace imports across server-to-client component boundaries and dynamic imports - Trace imports across server-to-client component boundaries and dynamic imports
See [Package Bundling](/docs/app/guides/package-bundling) for optimization strategies. See [Package Bundling](/docs/app/guides/package-bundling#optimizing-large-bundles) for optimization strategies.
To write the analysis output to disk without starting the server, use the `--output` flag. The output is written to `.next/diagnostics/analyze` and contains static files that can be copied elsewhere or shared with others: To write the analysis output to disk without starting the server, use the `--output` flag. The output is written to `.next/diagnostics/analyze` and contains static files that can be copied elsewhere or shared with others:
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
title: optimizePackageImports title: optimizePackageImports
description: API Reference for optimizePackageImports Next.js Config Option description: API Reference for optimizePackageImports Next.js Config Option
source: app/api-reference/config/next-config-js/optimizePackageImports source: app/api-reference/config/next-config-js/optimizePackageImports
version: experimental
--- ---
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */} {/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
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