Post-processing tool for esbuild that replaces references to source files (like .ts, .tsx) in copied HTML entry files with the corresponding output files (e.g., .js, .css). It uses the esbuild metafile to map source entrypoints to their output bundles. Current version 1.1.0 requires esbuild >=0.24.1 because earlier versions do not mark HTML files as entrypoints in the metafile. It is a lightweight CLI tool (single binary) with no other runtime dependencies, designed to simplify esbuild HTML workflows.
npm install esbuild-html-linkNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Use esbuild-html-link programmatically with esbuild's JavaScript API. This example builds an HTML entry point, then rewrites script/src and link/href attributes in the copied HTML to point to output bundles.
Upgrade esbuild to >=0.24.1.
Ensure your HTML files are listed as entryPoints in esbuild config.
Use import syntax or dynamic import() in Node project with type: 'module'.
Always specify the metafile path explicitly with -m or --metafile.
Change to import statement or use dynamic import() in an ESM context.
Ensure you pass the metafile from esbuild's build result: { metafile: result.metafile }.