{"id":21939,"library":"rollup-plugin-bundle-fonts","title":"rollup-plugin-bundle-fonts","description":"A Rollup plugin that downloads HTTPS fonts referenced in CSS `url()` functions and copies them to a target directory, updating the URLs to relative paths. Current version 1.2.1, compatible with Rollup 3.0+ and Node.js LTS v16+. Unlike generic asset plugins, it specifically handles font downloading with optional download delays, include/exclude patterns, and automatic URL rewriting based on CSS bundle location. Does not clear the font directory between runs, only downloads missing fonts.","status":"active","version":"1.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/mgreminger/rollup-plugin-bundle-fonts","tags":["javascript","rollup","rollup-plugin"],"install":[{"cmd":"npm install rollup-plugin-bundle-fonts","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-bundle-fonts","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-bundle-fonts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export. ESM-only; CommonJS require will fail. Use import.","wrong":"const bundleFonts = require('rollup-plugin-bundle-fonts')","symbol":"default","correct":"import bundleFonts from 'rollup-plugin-bundle-fonts'"},{"note":"Do not use named import. The package exports a default function.","wrong":"import { bundleFonts } from 'rollup-plugin-bundle-fonts'","symbol":"bundleFonts","correct":"import bundleFonts from 'rollup-plugin-bundle-fonts'"}],"quickstart":{"code":"import bundleFonts from 'rollup-plugin-bundle-fonts';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'es'\n  },\n  plugins: [\n    bundleFonts({\n      fontTargetDir: 'dist/fonts',\n      cssBundleDir: 'dist',\n      delay: 100\n    })\n  ]\n};","lang":"javascript","description":"Basic Rollup config using bundleFonts plugin with required options fontTargetDir and cssBundleDir, plus optional delay."},"warnings":[{"fix":"Always provide both fontTargetDir and cssBundleDir options.","message":"fontTargetDir and cssBundleDir are required but not validated at build time; missing them causes runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually delete the font directory between builds if you need fresh downloads.","message":"The plugin only downloads fonts that are missing in fontTargetDir; existing files are not overwritten.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"To add 1 second delay, set delay to 1000000.","message":"Delay option is in microseconds, not milliseconds. A typical delay of 100 means 0.1 ms.","severity":"gotcha","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install rollup-plugin-bundle-fonts --save-dev' and ensure node_modules exists.","cause":"The plugin is not installed or is installed as devDependency but missing from node_modules.","error":"Cannot find module 'rollup-plugin-bundle-fonts'"},{"fix":"Use 'import bundleFonts from 'rollup-plugin-bundle-fonts'' (without curly braces).","cause":"Using named import instead of default import.","error":"TypeError: bundleFonts is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}