Skip to content

next build --stats #1226

@rauchg

Description

@rauchg

Would produce .next/stats.json and pass the profile flags to webpack

I tried this in next.config.js:

const StatsPlugin = require("stats-webpack-plugin")

module.exports = {
  webpack (cfg) {
    if (process.env.WEBPACK_STATS) {
      cfg.profile = true
      cfg.plugins.push(
        new StatsPlugin('stats.json', {
          timings: true,
          assets: true,
          chunks: true,
          chunkModules: true,
          modules: true,
          children: true,
          cached: true,
          reasons: true
        })
      )
    }
    return cfg
  }
}

But I think we need to handle it on next since it only contained main.js and common.js, and not any of the generated pages.

Ideally I would like the webpack plugin to work out of the box though

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions