jfortunato / esbuild-plugin-manifest

Esbuild plugin for building an asset manifest file.
MIT License
31 stars 5 forks source link

Skipping outputs without entrypoints prevents using paths of e.g. file-loader resources #15

Closed emilbjorklund closed 10 months ago

emilbjorklund commented 11 months ago

Use case

When building a manifest, I would like to have references to external files loaded from entry points, not just entry points. For example, my CSS loads a font file, and I would like to reference the hashed name of that file in a <link rel="preload"> tag in HTML using the manifest.

Expected behavior

When building something that uses an external file loader, e.g. in my case a CSS file that points to a font file, I would expect the font file to be part of the manifest.

Observed behavior

Font file is not part of the manifest.

Hypothesis

It seems this line ignores any outputs that lack the entryPoint key: https://github.com/jfortunato/esbuild-plugin-manifest/blob/c1c747fc5a143da93e25727c63391d30a3e3d3db/src/index.ts#L70

Sadly, this also ignores things like external files.

Hypothetically, this check (and the mapping that follows) could perhaps see if the output either has a) an entryPoint or b) a single input, which seems to be the case for external files?

jfortunato commented 10 months ago

Starting with v1.0.0 all the generated outputs should be included in the manifest file.