craftamap/esbuild-plugin-html

Support injection of asset by output name instead of entrypoint name

vpanta opened this issue · 3 comments

For cases where it might be simpler, it would be nice to be able to have an injectedOutputs configuration option instead of (or in addition to) entryPoints. This way you can declare the injected assets by esbuild output name instead of only by entryPoint name.

Thanks for the issue and the PR:) I was just wondering if this is not achievable with extraScripts already?

Uncertain, the issue came up with our local changes because something in our own build options causes the entryPoints to be listed as a giant relative path (../../../../../some/path/to/entrypoint) in the metafile. So matching is near impossible. But the expected output is much saner to match on.

This is honestly a take it or leave it. Since I was patching our local usage, I figured I'd put up a quick suggested PR as well, but I definitely understand if this isn't a feature you want to suppport.

I'm going to close this one because I find it messy and you're probably right that it could be handled with extraScripts. If you're interested in it and want it re-opened, I can resurrect my branch later.