Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat #3666 add optional exclude option for plugin onLoad and onResolve hooks #3667

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sod
Copy link
Contributor

@sod sod commented Feb 24, 2024

This allows plugins that are very broadly applied to user code, to ignore files and folders it knows not to touch, like node_modules, static files or shared folders.

As the cost of calling a plugin is not 0, especially onResolve hooks, this could help improve performance of plugins.

See #3666

used like:

const myPlugin = {
  name: 'my-plugin',
  setup(build) {
    build.onResolve({ filter: /.js$/, exclude: /^(static|my-lib)\// }, args => {
    })
    build.onLoad({ filter: /.js$/, exclude: /\/node_modules\// }, args => {
    })
  }
}

the exclude is optional and the filter-only syntax stil works.

@sod
Copy link
Contributor Author

sod commented May 2, 2024

@evanw whats your stance on this? Should I rebase, change something or drop? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant