This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Output which JS chunks are loaded on which pages #15481
Comments
I think I read somewhere that the next.js team is working on better performance tooling for next.js. In the meantime you can use some webpack tools to analyze your bundles dependencies. This requires using a custom webpack configuration in In your custom webpack configuration, define a custom webpack: function(config, { isServer }) {
if (!isServer && process.env.ANALYZE === 'true') {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: './analyze/client.html',
generateStatsFile: true
})
);
}
return config;
}, Note that using the Once you have configured that, you can run
|
Thanks @jeantil! I've already got the FoamTree visualization using the The Next.js team definitely needs to look into better performance tooling (as that's a big part of the appeal of using Next.js in the first place IMO haha). |
Yeah, so I just used that new config, and it definitely speeds up the build times from using the But I still don't know which chunks are loaded by which pages (i.e. which chunks are adding to each page's "First Load JS" size). That was the main problem I was facing earlier. |
Uses the temporary fix proposed by @jeantil in vercel/next.js#15481.
Webpack analyse chunk analysis has issues but the module analysis works and I found that more useful than tracking chunks. search your page in the module list click on the green hash and it will list all the imported depednencies which you can then recursively explore |
Check |
I was looking to make progress on this when I found out this issue on webpack-bundle-analyzer site: webpack-contrib/webpack-bundle-analyzer#265 It seems that their are also looking to help our case |
in my latest comment on this issue I said:
To clarify I was talking about http://webpack.github.io/analyse/ and I tracked the issue to webpack/analyse#45 which was true at the time I don't have time for this right now but if the issue in that PR is still present, maybe next could be changed to use numeric ids since analyse doesn't seem to want that change |
You might want to try Statoscope to see if that would work for the use case defined here: https://github.com/smelukov/statoscope/blob/master/packages/ui-webpack/README.md |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Feature request
Is your feature request related to a problem? Please describe.
A clear and concise description of what you want and what your use case is.
I'm trying to increase the speed of my website by decreasing the initial load JS size.
So, I'm using the
@next/bundle-analyzer
package, but I don't know which chunks are loaded by which pages.Right now, the output of
next build
looks like this:From that, I do know some things:
next build
).But I still don't know about some chunks and where they're being loaded. For example:
Where is
chunks/ee76791a057a2d97d7c29a1b0c13f7cc0bf68bb2.js
listed in the build output? Nowhere!Describe the solution you'd like
A clear and concise description of what you want to happen.
The
next build
command should output all of the chunks that are loaded by the various pages (or, at least, thenext build --verbose
command that's described in #15281).Ideally, you might also provide a built-in
next build --analyze
command or just anext analyze
to analyze the bundle sizes.The text was updated successfully, but these errors were encountered: