Skip to content

[v2] - CSS minifier crash the build due to fonts #3836

@semoal

Description

@semoal

🐛 Bug Report

/Users/x/Projects/docs-v2/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js:30
          throw e;
          ^

TypeError: Cannot read property '0' of undefined
    at Object.font [as breakUp] (/Users/x/Projects/docs-v2/node_modules/clean-css/lib/optimizer/level-2/break-up.js:303:91)
    at populateComponents (/Users/x/Projects/docs-v2/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js:17:42)
    at /Users/x/Projects/docs-v2/node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js:141:9

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

(Write your steps here:)

  1. npx @docusaurus/init@latest init my-website classic
  2. Add a font on custom.css
 @font-face {
  font-family: 'Manrope';
  src: url("/fonts/Manrope.ttf") format("truetype");
  font-style: normal;
  font-display: swap
}

If I remove this code from the css file, the crash disappears.

  1. Add a font.ttf in static folder
  2. Run yarn build

Expected behavior

To not crash

Your Environment

  • Docusaurus version used: 2.0.0-alpha.69
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node v12.16.0

Reproducible Demo

I'll post one asap

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions