Registry / web-framework / font-subset-loader2

font-subset-loader2

JSON →
library1.1.7jsnpmunverified

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.

npm install font-subset-loader2
INSTALL
IMPORT
SIG · FONT-SUBSET-LOADER
F
font-subset-loader2
web-frameworkjavascriptv1.1.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import fontSubsetLoader from 'font-subset-loader2'
const fontSubsetLoader = require('font-subset-loader2')
Loader is used via webpack config, not imported in code.

Webpack config to subset TTF font to include only specified glyphs.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.ttf$/, use: [ { loader: 'font-subset-loader2', options: { glyphs: 'hello, world!' } }, { loader: 'file-loader', options: { name: '[name].[ext]' } } ] } ] } };
Debug
Known issues
gotchaGlyphs containing special characters must be passed via options object, not query string, to avoid webpack parsing issues.
fix
Use 'options: { glyphs: '...' }' instead of inline query string.
affects: all
breakingThis package is incompatible with webpack <4. It requires webpack 4+ and does not work with webpack 3 or earlier.
fix
Upgrade to webpack 4 or 5.
affects: all
gotchaThe loader only works with TTF fonts. Other font formats (OTF, WOFF, etc.) are not supported.
fix
Convert fonts to TTF before using this loader.
affects: all
Errors
Common errors & fixes
Module parse failed: Unexpected character '' (1:0) You may need an appropriate loader to handle this file type.
Missing font-subset-loader2 rule for .ttf files or incorrect loader order.
fix
Ensure webpack config includes { test: /\.ttf$/, use: ['font-subset-loader2'] } and that it is the first loader in the 'use' array.
Upgrade
Version history
1.1.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
font-subset-loader2 — npm install font-subset-loader2 · libregistry