Skip to content

Commit

Permalink
Revert "Unrelated"
Browse files Browse the repository at this point in the history
This reverts commit 468084d.
  • Loading branch information
kdy1 committed Apr 3, 2024
1 parent 4416330 commit abda21f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-api/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ impl PageEndpoint {
.read()
.await?,
FileContent::NotFound
);
) || true;

let next_font_manifest_output = create_font_manifest(
this.pages_project.project().client_root(),
Expand Down
16 changes: 16 additions & 0 deletions packages/next/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ function getNextFontLinkTags(
preload: null,
}
}
console.log(
'nextFontManifest',
nextFontManifest,
'dangerousAsPath',
dangerousAsPath,
'assetPrefix',
assetPrefix
)

const appFontsEntry = nextFontManifest.pages['/_app']
const pageFontsEntry = nextFontManifest.pages[dangerousAsPath]
Expand All @@ -375,6 +383,14 @@ function getNextFontLinkTags(
new Set([...(appFontsEntry ?? []), ...(pageFontsEntry ?? [])])
)

console.log(
'preloadedFontFiles',
preloadedFontFiles,
'appFontsEntry',
appFontsEntry,
'pageFontsEntry',
pageFontsEntry
)
// If no font files should preload but there's an entry for the path, add a preconnect tag.
const preconnectToSelf = !!(
preloadedFontFiles.length === 0 &&
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/next-font/without-preloaded-fonts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ describe('next/font/google no preloads with _app', () => {

test('without fonts', async () => {
const html = await renderViaHTTP(next.url, '/without-fonts')
console.log('html', html)
const $ = cheerio.load(html)

// <link data-next-font="size-adjust" rel="preconnect" href="/" crossorigin="anonymous"/>

// Preconnect
expect($('link[rel="preconnect"]').length).toBe(1)
expect($('link[rel="preconnect"]').get(0).attribs).toEqual({
Expand Down

0 comments on commit abda21f

Please sign in to comment.