Skip to content

manualChunks()

  • Type: optional manualChunks: (moduleId, meta) => string | NullValue

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
{
  advancedChunks: {
    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 | NullValue

Deprecated

Please use output.advancedChunks instead.

WARNING

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

Released under the MIT License.