esbuild
esbuild copied to clipboard
feat #3666 add optional exclude option for plugin `onLoad` and `onResolve` hooks
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.
@evanw whats your stance on this? Should I rebase, change something or drop? :)