esbuild
esbuild copied to clipboard
Support file:// URLs where paths as are supported.
When dealing with paths in Node.js, people often use URL instances. This is especially true when writing ESM scripts, where import.meta.url
is available, but not __dirname
, or __filename
. The Node.js fs
APIs already support URL instances where paths are allowed.
I think it might would be useful for esbuild to also support file URLs where paths are expected. Currently they need to be converted to strings using fileURLToPath
.
I.e.
onResolve({ filter: /\/schemaSelectionHandlers$/ }, () => ({
- path: fileURLToPath(new URL('src/fillers/schemaSelectionHandlers.ts', import.meta.url)),
+ path: new URL('src/fillers/schemaSelectionHandlers.ts', import.meta.url),
}));