-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Update package-bundling.mdx #83498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Update package-bundling.mdx #83498
Conversation
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
@@ -53,6 +53,8 @@ ANALYZE=true pnpm build | |||
|
|||
The report will open three new tabs in your browser, which you can inspect. Periodically evaluating your application's bundles can help you maintain application performance over time. | |||
|
|||
> **Note:** `create-next-app` generate the `scripts` in `package.json` is `"build": "next build --turbopack"`. The `--turbopack` will cause the analyzer not working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rephrase and move it up to
https://nextjs.org/docs/app/guides/package-bundling#analyzing-javascript-bundles
Analyzing JavaScript bundles
I guess, what we want to say is that @next/analyzer
doesn't yet support Turbopack builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! This description is indeed a bit mess. What about we place the note below the "Generating a report" code block? Just to prevent someone from struggling to recall the content they read at the beginning? What do you think?
`@next/analyzer` doesn't yet support Turbopack builds.
Please ensure your `build` script doesn't include the `--turbopack` option when analyzing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doesn't support Turbopack builds is enough.
When you build, if you are using Turbopack that's clearly printed
I wonder if the analyzer should also warn about this 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
▲ Next.js 15.5.2 (Turbopack)
Creating an optimized production build ...
⚠ 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/turbopack
It says I need to configure Turbopack. So I think maybe something wrong about Turbopack config directly and get into pitfall for fixing Turbopack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @next/bundle-analyzer
is a thin wrapper around webpack-bundle-analyzer
:
As it modifies the Webpack key in the config, the Turbopack run prints a warning that there might be problems. Some people used Webpack to compile other files for example, and that wouldn't happen if using Turbopack.
See these two comments:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now. But to fresh user to use @next/bundle-analyzer
by following the step from docs, they will not get expect behavior and get a warning from Turbopack (not from @next/bundle-analyzer
). That not make sense I think.🫣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah - I do think we need a short good to know
, or just straight up say in the text that when using Turbopack the analyzer is not working.
Let's add the note, with a link to https://nextjs.org/docs/app/api-reference/turbopack#getting-started - where one would see the --turbopack
option
aeb0fdf
to
fa22cc3
Compare
Signed-off-by: lihsai0 <[email protected]>
What?
Add a note for using
@next/bundle-analyzer
.Why?
While using
@next/bundle-analyzer
, I encountered an issue and figuring out the cause. I believe this should be mentioned in the documentation.