stats-config.js 4.5 KB
Newer Older
1 2 3 4 5
const clientGlobs = [
  {
    name: 'Client Bundles (main, webpack, commons)',
    globs: [
      '.next/static/runtime/+(main|webpack)-!(*.module.js)',
6
      '.next/static/chunks/!(polyfills-*|*.module.js)',
7
    ],
8 9 10 11 12
  },
  {
    name: 'Client Bundles (main, webpack, commons) Modern',
    globs: [
      '.next/static/runtime/+(main|webpack)-*.module.js',
13
      '.next/static/chunks/!(polyfills-*)*.module.js',
14
    ],
15
  },
J
Joe Haddad 已提交
16 17
  {
    name: 'Legacy Client Bundles (polyfills)',
18
    globs: ['.next/static/chunks/+(polyfills)-!(*.module.js)'],
J
Joe Haddad 已提交
19
  },
20 21
  {
    name: 'Client Pages',
22
    globs: ['.next/static/*/pages/**/!(*.module.js)'],
23 24 25
  },
  {
    name: 'Client Pages Modern',
26
    globs: ['.next/static/*/pages/**/*.module.js'],
27 28 29
  },
  {
    name: 'Client Build Manifests',
30
    globs: ['.next/static/*/_buildManifest*'],
31 32 33
  },
  {
    name: 'Rendered Page Sizes',
34 35
    globs: ['fetched-pages/**/*.html'],
  },
36 37 38 39 40
]

const renames = [
  {
    srcGlob: '.next/static/*/pages',
41
    dest: '.next/static/BUILD_ID/pages',
42 43 44
  },
  {
    srcGlob: '.next/static/runtime/main-!(*.module.js)',
45
    dest: '.next/static/runtime/main-HASH.js',
46 47 48
  },
  {
    srcGlob: '.next/static/runtime/webpack-!(*.module.js)',
49
    dest: '.next/static/runtime/webpack-HASH.js',
50
  },
J
Joe Haddad 已提交
51 52
  {
    srcGlob: '.next/static/runtime/polyfills-!(*.module.js)',
53
    dest: '.next/static/runtime/polyfills-HASH.js',
J
Joe Haddad 已提交
54
  },
55 56
  {
    srcGlob: '.next/static/chunks/commons!(*.module.js)',
57
    dest: '.next/static/chunks/commons.HASH.js',
58
  },
59 60
  {
    srcGlob: '.next/static/chunks/framework!(*.module.js)',
61
    dest: '.next/static/chunks/framework.HASH.js',
62
  },
63 64 65
  // modern
  {
    srcGlob: '.next/static/runtime/main-*.module.js',
66
    dest: '.next/static/runtime/main-HASH.module.js',
67 68 69
  },
  {
    srcGlob: '.next/static/runtime/webpack-*.module.js',
70
    dest: '.next/static/runtime/webpack-HASH.module.js',
71 72 73
  },
  {
    srcGlob: '.next/static/chunks/commons*.module.js',
74
    dest: '.next/static/chunks/commons.HASH.module.js',
75
  },
76 77
  {
    srcGlob: '.next/static/chunks/framework*.module.js',
78
    dest: '.next/static/chunks/framework.HASH.module.js',
79
  },
80 81 82
  // misc
  {
    srcGlob: '.next/static/*/_buildManifest.js',
83
    dest: '.next/static/BUILD_ID/_buildManifest.js',
84 85 86
  },
  {
    srcGlob: '.next/static/*/_buildManifest.module.js',
87 88
    dest: '.next/static/BUILD_ID/_buildManifest.module.js',
  },
89 90 91 92 93
]

module.exports = {
  commentHeading: 'Stats from current PR',
  commentReleaseHeading: 'Stats from current release',
94 95
  appBuildCommand: 'NEXT_TELEMETRY_DISABLED=1 yarn next build',
  appStartCommand: 'NEXT_TELEMETRY_DISABLED=1 yarn next start --port $PORT',
96
  mainRepo: 'vercel/next.js',
97 98 99 100 101 102 103 104 105 106 107
  mainBranch: 'canary',
  autoMergeMain: true,
  configs: [
    {
      title: 'Default Server Mode',
      diff: 'onOutputChange',
      diffConfigFiles: [
        {
          path: 'next.config.js',
          content: `
            module.exports = {
108
              generateBuildId: () => 'BUILD_ID',
109 110 111 112 113 114
              webpack(config) {
                config.optimization.minimize = false
                config.optimization.minimizer = undefined
                return config
              },
              experimental: {
115
                modern: true
116 117
              }
            }
118 119
          `,
        },
120 121 122 123 124 125 126 127
      ],
      // renames to apply to make file names deterministic
      renames,
      configFiles: [
        {
          path: 'next.config.js',
          content: `
            module.exports = {
128
              generateBuildId: () => 'BUILD_ID',
129
              experimental: {
130
                modern: true
131 132
              }
            }
133 134
          `,
        },
135 136
      ],
      filesToTrack: clientGlobs,
137
      // will be output to fetched-pages/${pathname}.html
138
      pagesToFetch: [
139
        'http://localhost:$PORT/',
140
        'http://localhost:$PORT/link',
141 142
        'http://localhost:$PORT/withRouter',
      ],
143 144 145 146 147 148 149 150 151
      pagesToBench: [
        'http://localhost:$PORT/',
        'http://localhost:$PORT/error-in-render',
      ],
      benchOptions: {
        reqTimeout: 60,
        concurrency: 50,
        numRequests: 2500,
      },
152 153 154 155 156 157 158 159 160 161
    },
    {
      title: 'Serverless Mode',
      diff: false,
      renames,
      configFiles: [
        {
          path: 'next.config.js',
          content: `
            module.exports = {
162
              generateBuildId: () => 'BUILD_ID',
163 164
              target: 'serverless',
              experimental: {
165
                modern: true
166 167
              }
            }
168 169
          `,
        },
170 171 172 173 174
      ],
      filesToTrack: [
        ...clientGlobs,
        {
          name: 'Serverless bundles',
175 176 177 178 179
          globs: ['.next/serverless/pages/**/*'],
        },
      ],
    },
  ],
180
}