Skip to content

Interface: HookFilter

Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/define-config-DO4TBkJV.d.mts:1708

A filter to be used to do a pre-test to determine whether the hook should be called.

See Plugin Hook Filters page for more details.

Properties

code?

ts
optional code: GeneralHookFilter<string | RegExp>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/define-config-DO4TBkJV.d.mts:1756

A filter based on the module's code.

Only available for transform hook.


id?

ts
optional id: GeneralHookFilter<string | RegExp>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/define-config-DO4TBkJV.d.mts:1744

A filter based on the module id.

If the value is a string, it is treated as a glob pattern. The string type is not available for resolveId hook.

Examples

Include all ids that contain node_modules in the path.

js
{
  id: '**' + '/node_modules/**'
}

Include all ids that contain node_modules or src in the path.

js
{
  id: ['**' + '/node_modules/**', '**' + '/src/**']
}

Include all ids that start with http

js
{
  id: /^http/
}

Exclude all ids that contain node_modules in the path.

js
{
  id: {
    exclude: '**' + '/node_modules/**'
  }
}

Formal pattern to define includes and excludes.

js
{ id : {
  include: ['**'+'/foo/**', /bar/],
  exclude: ['**'+'/baz/**', /qux/]
}}

moduleType?

ts
optional moduleType: ModuleTypeFilter;

Defined in: node_modules/.pnpm/rolldown@1.0.0-rc.1/node_modules/rolldown/dist/shared/define-config-DO4TBkJV.d.mts:1750

A filter based on the module's moduleType.

Only available for transform hook.

Released under the MIT License.