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

Default font config fix #42235

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/next/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ export function setHttpClientAndAgentOptions(config: NextConfig) {
}

async function setFontLoaderDefaults(config: NextConfigComplete, dir: string) {
if (config.experimental?.fontLoaders) return

// Add @next/font loaders by default if they're installed
const hasNextFontDependency = (
await getDependencies({
Expand All @@ -114,14 +112,14 @@ async function setFontLoaderDefaults(config: NextConfigComplete, dir: string) {
}
if (
!config.experimental.fontLoaders.find(
({ loader }: any) => loader === '@next/font/goggle'
({ loader }: any) => loader === googleFontLoader.loader
)
) {
config.experimental.fontLoaders.push(googleFontLoader)
}
if (
!config.experimental.fontLoaders.find(
({ loader }: any) => loader === '@next/font/local'
({ loader }: any) => loader === localFontLoader.loader
)
) {
config.experimental.fontLoaders.push(localFontLoader)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/app-dir/next-font/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
experimental: {
appDir: true,
fontLoaders: [],
},
}
3 changes: 1 addition & 2 deletions test/e2e/next-font/basepath/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ module.exports = {
experimental: {
fontLoaders: [
{
loader: '@next/font/google',
options: { subsets: ['latin'] },
loader: '@next/font/local',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/next-font/basepath/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Open_Sans } from '@next/font/google'
const openSans = Open_Sans()
const openSans = Open_Sans({ subsets: ['latin'] })

export default function Inter() {
return <p className={openSans.className}>Hello world</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ module.exports = {
loader: '@next/font/google',
options: { subsets: ['latin'] },
},
{
loader: '@next/font/local',
},
],
},
}