{"id":20040,"library":"font-subset-loader2","title":"font-subset-loader2","description":"A webpack loader for subsetting TTF font files to include only specified glyphs, reducing file size. Compatible with webpack 4 and 5, it forked the unmaintained font-subset-loader to update dependencies and fix compatibility. Stable version 1.1.7, with infrequent releases. Alternatives like fontmin-webpack or glyphhanger offer more features, but this loader integrates natively with webpack load chain, processing fonts as resources before file/url-loader.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/hk029/font-subset-loader","tags":["javascript"],"install":[{"cmd":"npm install font-subset-loader2","lang":"bash","label":"npm"},{"cmd":"yarn add font-subset-loader2","lang":"bash","label":"yarn"},{"cmd":"pnpm add font-subset-loader2","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Loader is used via webpack config, not imported in code.","wrong":"const fontSubsetLoader = require('font-subset-loader2')","symbol":"default","correct":"import fontSubsetLoader from 'font-subset-loader2'"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ttf$/,\n        use: [\n          {\n            loader: 'font-subset-loader2',\n            options: {\n              glyphs: 'hello, world!'\n            }\n          },\n          {\n            loader: 'file-loader',\n            options: {\n              name: '[name].[ext]'\n            }\n          }\n        ]\n      }\n    ]\n  }\n};","lang":"javascript","description":"Webpack config to subset TTF font to include only specified glyphs."},"warnings":[{"fix":"Use 'options: { glyphs: '...' }' instead of inline query string.","message":"Glyphs containing special characters must be passed via options object, not query string, to avoid webpack parsing issues.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to webpack 4 or 5.","message":"This package is incompatible with webpack <4. It requires webpack 4+ and does not work with webpack 3 or earlier.","severity":"breaking","affected_versions":"all"},{"fix":"Convert fonts to TTF before using this loader.","message":"The loader only works with TTF fonts. Other font formats (OTF, WOFF, etc.) are not supported.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure webpack config includes { test: /\\.ttf$/, use: ['font-subset-loader2'] } and that it is the first loader in the 'use' array.","cause":"Missing font-subset-loader2 rule for .ttf files or incorrect loader order.","error":"Module parse failed: Unexpected character '' (1:0)\nYou may need an appropriate loader to handle this file type."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}