esbuild
esbuild copied to clipboard
add an optional cache and `exclude` option to the `onResolve` plugin hook
As the angular-cli right now fully commits to esbuild, the onResolve
hook reveals itself as a pretty stark performance hinderance to the otherwise astonishing speed of esbuild.
In my mind this is how the API could look like to improve:
build.onResolve({ filter: /^[^./]/, exclude: /^(@angular|rxjs)\// } }, async (args) => {
if (/* some condition */) {
return { path: args.path, external: true, cachable: true };
}
return { path: args.path, cachable: true };
});
- The
exclude
option could be a way around the missing lookahead feature of go-regex. To stamp out imports we don't want to look at - The opt-in
cachable: true
could tell esbuild to not ask for the same information again, which would be nice for watcher performance
Would you be open to this idea and if yes, would you appreciate a PR contribution?
Maybe the cachable is a bit much. But the exclude
option could go a long way.