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
{{ message }}
Repository navigation
Non-JS extensions not always throwing in ESM resolver #30632
I managed to track this one down and it is actually not a bug after all. @GeoffreyBooth when you called resolve(specifier) in the loader you only provided one argument to the resolver (whereas the resolver takes two arguments - the specifier, and the parent specifier. When no parent specifier is provided this is taken to mean isMain (Node.js main entry). Which results in a different resolution rule that extensions don't matter. This was done to support extensionless bin files and is correct by the specification isMain check in ESM_FORMAT. If you simply provide the parentUrl to the resolve call in your loader example there you will find it throws an error.
Thanks so much @adarshsaraogi for offering to help here, if you are interested in contributing there are some other issues labelled ES modules / help wanted / good first issue that I'd be glad to help you with.
Activity
adarshsaraogi commentedon Nov 25, 2019
hi I would like to work on this.
guybedford commentedon Nov 25, 2019
I managed to track this one down and it is actually not a bug after all. @GeoffreyBooth when you called
resolve(specifier)in the loader you only provided one argument to the resolver (whereas the resolver takes two arguments - the specifier, and the parent specifier. When no parent specifier is provided this is taken to meanisMain(Node.js main entry). Which results in a different resolution rule that extensions don't matter. This was done to support extensionless bin files and is correct by the specificationisMaincheck in ESM_FORMAT. If you simply provide the parentUrl to the resolve call in your loader example there you will find it throws an error.Thanks so much @adarshsaraogi for offering to help here, if you are interested in contributing there are some other issues labelled ES modules / help wanted / good first issue that I'd be glad to help you with.