Skip to content

[Bug](vite): limiting subset does not affect variable fonts (@fontsource-variable/roboto) #90

@aentwist

Description

@aentwist

Demo URL

No response

What happened?

I am using @fontsource-variable/roboto, and the vite plugin with the following config:

    ViteFonts({
      fontsource: {
        families: [
          {
            name: "Roboto",
            subset: "latin",
            variable: {
              wght: true, // Enable weight axis
              ital: true, // Italic
            },
          },
        ],
      },
    }),

Even though I limit subset to latin, all others are still included.

    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-cyrillic-wght-italic-BQuZY0ec.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-cyrillic-ext-wght-italic-B-UKatGS.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-greek-ext-wght-italic-Cf6Wh-ak.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-greek-wght-italic-NsgT4ukU.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-symbols-wght-italic-mQQU5nC4.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-math-wght-italic-Dwush0cz.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-vietnamese-wght-italic-LqXHS6oa.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-latin-ext-wght-italic-cqKqHPSO.woff2" crossorigin="anonymous">
    <link rel="preload" as="font" type="font/woff2" href="/assets/roboto-latin-wght-italic-HlDuTyNj.woff2" crossorigin="anonymous">

Reproduction steps

1. install fontsource roboto variable (separates subset by file)
2. use vite plugin with latin subset
3. build and verify

Relevant log output

$ npm run build
vite v7.2.7 building client environment for production...
✓ 2150 modules transformed.
dist/index.html                                                 1.64 kB │ gzip:   0.47 kB
dist/assets/roboto-greek-ext-wght-italic-Cf6Wh-ak.woff2         4.47 kB
dist/assets/roboto-vietnamese-wght-italic-LqXHS6oa.woff2       13.96 kB
dist/assets/roboto-greek-wght-italic-NsgT4ukU.woff2            18.80 kB
dist/assets/roboto-symbols-wght-italic-mQQU5nC4.woff2          22.29 kB
dist/assets/roboto-cyrillic-wght-italic-BQuZY0ec.woff2         24.57 kB
dist/assets/roboto-latin-ext-wght-italic-cqKqHPSO.woff2        28.54 kB
dist/assets/roboto-cyrillic-ext-wght-italic-B-UKatGS.woff2     39.53 kB
dist/assets/roboto-latin-wght-italic-HlDuTyNj.woff2            44.19 kB
dist/assets/roboto-math-wght-italic-Dwush0cz.woff2             44.41 kB

What browsers are you seeing the problem on?

No response

What is your operating system?

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions