esbuild-qfile (v0.2.3) is a plugin for esbuild that enables loading files as strings with a query parameter syntax (e.g., import x from './file?file'). It provides a simple way to inline file contents during bundling, useful for embedding resources. The plugin is lightweight, with no additional dependencies beyond esbuild itself. It is maintained as a single-purpose utility for esbuild's plugin ecosystem, with slow release cadence (last updated in 2022). Key differentiator: minimal configuration compared to other file loaders.
npm install esbuild-qfileNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use esbuild-qfile as a plugin in an esbuild build script, with a comment showing usage of the ?file query.
Use lowercase `?file` in import paths.
Ensure esbuild build options include `bundle: true`.
Use for text-based files only (SVG, CSS, text, etc.).
Add `qfile()` to the `plugins` array in esbuild build options.
Use `import qfile from 'esbuild-qfile'` (default import).