one important distinction to note down is the fact that the loader for the "no extension" case ("" empty string) is undefined,
meaning that it will use esbuild's own default loader for it (which happens to be "js" for such cases).
the reason why we don't directly assign a "js" loader to this case is because our super-build's transformer hooks may utilize the knowledge of whether a "default" was originally passed,
or if an actual "js" loader was intended to be used by the prior onLoad hook's callback.
PERMANENT-TODO: periodically check if the definitions are up to date.
TODO: also, in the future, define these extension loaders based on the version of esbuild that is being used,
using my semver resolver library from kitchensink.
TODO: ".cts" and ".mts" both internally use a LoaderTSNoAmbiguousLessThan loader, which is different from a LoaderTS.
however, the former is not exposed as a loader in javascript, where as the latter is.
for now, I'm setting both ".cts" and ".mts" to load via the "ts" loader, but I don't know if there will be any negative consequences of this later.
this dictates esbuild's default/native file-extension to loader mapping. it is roughly based on the following esbuild function:
"/internal/bundler/bundler.go":DefaultExtensionToLoaderMapone important distinction to note down is the fact that the loader for the "no extension" case (
""empty string) isundefined, meaning that it will use esbuild's own default loader for it (which happens to be"js"for such cases).the reason why we don't directly assign a
"js"loader to this case is because our super-build's transformer hooks may utilize the knowledge of whether a "default" was originally passed, or if an actual "js" loader was intended to be used by the prioronLoadhook's callback.PERMANENT-TODO: periodically check if the definitions are up to date.
TODO: also, in the future, define these extension loaders based on the version of esbuild that is being used, using my
semverresolver library from kitchensink.TODO:
".cts"and".mts"both internally use aLoaderTSNoAmbiguousLessThanloader, which is different from aLoaderTS. however, the former is not exposed as a loader in javascript, where as the latter is. for now, I'm setting both".cts"and".mts"to load via the"ts"loader, but I don't know if there will be any negative consequences of this later.