跳到正文

Interface: HookFilter

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:840

Properties

code?

ts
optional code: GeneralHookFilter<StringOrRegExp>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:875


id?

ts
optional id: GeneralHookFilter<StringOrRegExp>;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:873

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

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.

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

moduleType?

ts
optional moduleType: ModuleTypeFilter;

Defined in: node_modules/.pnpm/rolldown@1.0.0-beta.53/node_modules/rolldown/dist/shared/define-config-BS8Bt-r8.d.mts:874

Released under the MIT License.