The Wayback Machine - https://web.archive.org/web/20210119133146/https://github.com/vercel/next.js/issues/19159
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Optimization produces empty font definitions #19159

Closed
lukevmorris opened this issue Nov 13, 2020 · 1 comment
Closed

Font Optimization produces empty font definitions #19159

lukevmorris opened this issue Nov 13, 2020 · 1 comment

Comments

@lukevmorris
Copy link

@lukevmorris lukevmorris commented Nov 13, 2020

Bug report

Describe the bug

I've enabled experimental font optimization in next.config.js, but it does not work quite as described in the PR that introduced it.

To Reproduce

  1. Build and start a production server from my minimal repo:
git clone https://github.com/lukevmorris/font-optimization
cd font-optimization
npm install
npm run build
npm run start
  1. Open http://localhost:3000/
  2. Inspect the <head> of the document
  3. Inspect the built .next/server/font-manifest.json file

Expected behavior

The tag is transformed as expected

  • link href property is replaced with data-href of the same value
  • style tag is created with the same data-href key/value
  • style tag contains an inlined font definition

The .next/server/font-manifest.json contains font definitions as fetched from https://fonts.googleapis.com/css...

Actual behavior

The style tag exists but is empty:

<head>
  ...
  <link rel="stylesheet" data-href="https://fonts.googleapis.com/css?family=Voces">
  ...
  <style data-href="https://fonts.googleapis.com/css?family=Voces"></style>
  ...
</head>

Also the font-manifest.json file exists but contains just an empty array:

[]

System information

  • OS: macOS
  • Browser: Firefox
  • Version of Next.js: 10.0.1
  • Version of Node.js: 14.15.0
@timneutkens timneutkens added kind: bug and removed template: bug labels Nov 16, 2020
@kodiakhq kodiakhq bot closed this in #19758 Dec 4, 2020
kodiakhq bot pushed a commit that referenced this issue Dec 4, 2020
- Making font optimizations as default
- Re-enabling tests
- Fixes #19159
@Timer Timer added this to the iteration 14 milestone Dec 4, 2020
hanakla added a commit to fleur-js/next.js that referenced this issue Jan 2, 2021
- Making font optimizations as default
- Re-enabling tests
- Fixes vercel#19159
@mahcr
Copy link

@mahcr mahcr commented Jan 8, 2021

Did this get fixed? I still see the font-manifest.json empty. Next 10.0.5v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.