esbuild-vanilla-image-loader is a plugin (v0.1.3) for esbuild that enables importing image files (PNG, JPG, GIF, etc.) within vanilla-extract .css.ts files when using vanilla-extract's Vite plugin. It bridges a gap where vanilla-extract's esbuild-based build cannot handle image imports, allowing background-image URLs or data URIs in CSS. It is stable but young, with no breaking changes yet. Unlike general asset modules, this specifically targets the vanilla-extract/esbuild integration, offering a filter option and dataUrl mode. Released under MIT.
npm install esbuild-vanilla-image-loaderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures esbuild-vanilla-image-loader in a vanilla-extract Vite project, and imports an image in a .css.ts file.
Ensure you pass esbuildOptions.plugins inside vanillaExtractPlugin(), not in the main Vite esbuild config.
Use relative paths from the .css.ts file to your image assets.
Add import { ImageLoader } from 'esbuild-vanilla-image-loader' and include it in vanillaExtractPlugin's esbuildOptions.plugins.Run pnpm add esbuild-vanilla-image-loader -D and ensure tsconfig includes node_modules types.
No dependency data recorded yet.