Next.js Discord

Discord Forum

How can I get nextjs's json profile like webpack does?

Unanswered
Bruno Jura Hound posted this in #help-forum
Open in Discord
Bruno Jura HoundOP
Sorry for weird title couldn't formulate it right.
Using webpack I can do the following:
webpack --profile --json --config ./myconfig.js > graph.json

Can I get the same using next? I tried next build --help but profile is reserved for different purposes.

I want to get dependency graph of all my pages, like:
{
  ["./src/pages/somepage.js"]: ["./src/components/dependency1.js", "./src/components/dependency1.js"]
  ...
}


I know there is bundle analyzer. but I want to write a script which uses json file above and does some stuff with it

6 Replies

@Yi Lon Ma maybe you can try adding webpack ProfilingPlugin in next.config
Bruno Jura HoundOP
ProfilingPlugin does different job, it generates google chrome profile for debugging purposes.

What i need is a dependency tree
@Yi Lon Ma https://relative-ci.com/documentation/guides/bundle-stats/nextjs-webpack-stats I found this
Bruno Jura HoundOP
it doesnt produce dependency tree either

it shows in which chunk which file went
there are plenty of tools but i want to make sure that i cannot use wepback's information before switching to different approach a getting dependency tree