Skip to content

manualChunks()

  • Type: (moduleId, meta) => string | undefined | null | void
  • Optional

Allows you to do manual chunking. Provided for Rollup compatibility.

You could use this option for migration purpose. Under the hood,

js
{
  manualChunks: (moduleId, meta) => {
    if (moduleId.includes('node_modules')) {
      return 'vendor';
    }
    return null;
  }
}

will be transformed to

js
{
  codeSplitting: {
    groups: [
      {
        name(moduleId) {
          if (moduleId.includes('node_modules')) {
            return 'vendor';
          }
          return null;
        },
      },
    ],
  }
}

Note that unlike Rollup, object form is not supported.

Parameters

moduleId

string

meta

getModuleInfo

(moduleId) => ModuleInfo | null

Returns

string | undefined | null | void

Deprecated

Please use output.codeSplitting instead.

WARNING

If manualChunks and codeSplitting are both specified, manualChunks option will be ignored.