{"id":40951,"library":"esbuild-qfile","title":"esbuild-qfile","description":"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.","status":"active","version":"0.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/jsscheller/esbuild-qfile","tags":["javascript"],"install":[{"cmd":"npm install esbuild-qfile","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-qfile","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-qfile","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: required to use the plugin","package":"esbuild","optional":false}],"imports":[{"note":"Default export is the plugin function.","wrong":"const { qfile } = require('esbuild-qfile')","symbol":"default","correct":"import qfile from 'esbuild-qfile'"},{"note":"CommonJS require may need .default for ESM packages.","wrong":"const qfile = require('esbuild-qfile').default","symbol":"qfile","correct":"import qfile from 'esbuild-qfile'"},{"note":"Plugin type is from esbuild, not this package.","wrong":"import { Plugin } from 'esbuild-qfile'","symbol":"Plugin","correct":"import type { Plugin } from 'esbuild'"}],"quickstart":{"code":"const esbuild = require('esbuild');\nconst qfile = require('esbuild-qfile');\nesbuild.build({\n  entryPoints: ['app.js'],\n  bundle: true,\n  outfile: 'out.js',\n  plugins: [qfile()],\n}).catch(() => process.exit(1));\n\n// Then in app.js:\n// import svg from './icon.svg?file';\n// console.log(svg); // file contents as string","lang":"javascript","description":"Shows how to use esbuild-qfile as a plugin in an esbuild build script, with a comment showing usage of the ?file query."},"warnings":[{"fix":"Use lowercase `?file` in import paths.","message":"The query parameter is case-sensitive: must be `?file` exactly.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure esbuild build options include `bundle: true`.","message":"Only works with esbuild's `bundle` mode; does not work in transform-only mode.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use for text-based files only (SVG, CSS, text, etc.).","message":"File contents are returned as strings; binary files may cause issues.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/file':28 '2022':77 'addit':51 'beyond':53 'bundl':40 'cadenc':73 'compar':82 'configur':81 'content':38 'depend':52 'differenti':79 'e.g':24 'ecosystem':69 'embed':43 'enabl':14 'esbuild':2,5,12,54,66 'esbuild-qfil':1,4 'file':16,29,37,85 'import':25 'inlin':36 'javascript':87 'key':78 'last':74 'lightweight':48 'load':15 'loader':86 'maintain':58 'minim':80 'paramet':22 'plugin':10,46,68 'provid':31 'purpos':63 'qfile':3,6 'queri':21 'releas':72 'resourc':44 'simpl':33 'singl':62 'single-purpos':61 'slow':71 'string':18 'syntax':23 'updat':75 'use':41 'util':64 'v0.2.3':7 'way':34 'x':26","created_at":"2026-06-04T18:50:03.322866+00:00","updated_at":"2026-06-04T18:50:03.322866+00:00","problems":[{"fix":"Add `qfile()` to the `plugins` array in esbuild build options.","cause":"Forgetting to include the plugin in esbuild's plugins array.","error":"Error: No matching loader found for file extension .svg?file"},{"fix":"Use `import qfile from 'esbuild-qfile'` (default import).","cause":"Using a named import instead of default export.","error":"TypeError: qfile is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jsscheller/esbuild-qfile#readme","github":"https://github.com/jsscheller/esbuild-qfile","docs":null,"changelog":null,"pypi":null,"npm":"esbuild-qfile","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}