-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What Transpile `geist` package by default. Currently users need to add `geist` into `transpilePackages` to make it work with pages router as it's external packages but require transform. This PR will resolve that issue. cc @JohnPhamous ### Why geist package is using `next/font` which requires to work with SWC transform. But so far only ESM syntax can be captured by SWC since CJS is pretty difficult to cover as the package import is not statically analyzable. We introduced a new list that it could be transpiled and include geist package into bundle. Add it in both `next/jest` side and webpack/turbopack bundling side --------- Co-authored-by: 강동윤 (Donny) <kdy1997.dev@gmail.com>
- Loading branch information
Showing
9 changed files
with
98 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["geist"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { assertNoRedbox } from 'next-test-utils' | ||
|
||
describe('geist-font', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
dependencies: { | ||
geist: 'latest', | ||
}, | ||
}) | ||
|
||
it('should work with geist font in pages router', async () => { | ||
const browser = await next.browser('/foo') | ||
|
||
await assertNoRedbox(browser) | ||
const text = await browser.elementByCss('p').text() | ||
expect(text).toBe('Foo page') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { GeistSans } from 'geist/font/sans' | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
return ( | ||
<main className={GeistSans.className}> | ||
<Component {...pageProps} /> | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>Foo page</p> | ||
} |