You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
↑ callback here won't be fired on entrypoint JS file.
build.onResolve({filter: /someregexp/},args=>{});
↑ callback here will be fired on entrypoint JS file. And args.namespace will be an empty string.
It is probably related to #546, but I'm not sure. Is it a normal thing, or a bug? I want to make sure that my plugin do not process anything not related to it, and have decided to use namespace: 'file'. But I also need to process entrypoints. So right now I have to omit namespace setting in onResolve filtering.
(I can create a small example project to illustrate the behavior.)
The text was updated successfully, but these errors were encountered:
This is deliberate. The point of plugins is to be able to augment esbuild's behavior and give it new abilities. This includes the ability for a path to mean something else other than a file system path. For example, you might run esbuild with a URL as an entry point and with a plugin that moves paths to the url namespace since they are not file system paths. It seems wrong for esbuild to assume entry points are file system paths when that may not be the case.
I could potentially change this assumption to force entry points to be treated as file system paths. However, that would be a breaking change so it would have to wait until the next breaking change release.
This makes sense, thanks. But isn't it possible to determine what the entrypoint is when esbuild starts to resolve its path? I mean, when it is received a URL as an entrypoint, it starts to process them in url namespace, etc. Otherwise, why are the nested modules treated as being in file namespace? Isn't it depends only on the format of the imported path?
(Anyway, sure, the possible change of the current behavior should be breaking change, I'm not forcing to release any changes. Just want to understand the logic behind the scenes.)
Hey there!
I was writing a plugin and realized that
onResolve
is not fired on entrypoints when namespace equals'file'
.↑ callback here won't be fired on entrypoint JS file.
↑ callback here will be fired on entrypoint JS file. And
args.namespace
will be an empty string.It is probably related to #546, but I'm not sure. Is it a normal thing, or a bug? I want to make sure that my plugin do not process anything not related to it, and have decided to use
namespace: 'file'
. But I also need to process entrypoints. So right now I have to omit namespace setting inonResolve
filtering.(I can create a small example project to illustrate the behavior.)
The text was updated successfully, but these errors were encountered: