forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Font loaders next config shape (vercel#41219)
Changes how font loaders are configured in next config, makes more sense since options can be optional. Also adds error for when font loaders are used from within node_modules. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
- Loading branch information
Showing
15 changed files
with
92 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
throw new Error('@next/font/google is not correctly setup') | ||
throw new Error('@next/font/google is not correctly configured') |
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 |
---|---|---|
@@ -1 +1 @@ | ||
throw new Error('@next/font/local is not correctly setup') | ||
throw new Error('@next/font/local is not correctly configured') |
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
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
module.exports = { | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
'@next/font/local': {}, | ||
}, | ||
{ | ||
loader: '@next/font/local', | ||
}, | ||
], | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module.exports = { | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
module.exports = { | ||
basePath: '/dashboard', | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module.exports = { | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
13 changes: 8 additions & 5 deletions
13
test/e2e/next-font/with-font-declarations-file/next.config.js
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
module.exports = { | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
'@next/font/local': {}, | ||
}, | ||
{ | ||
loader: '@next/font/local', | ||
}, | ||
], | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module.exports = { | ||
experimental: { | ||
fontLoaders: { | ||
'@next/font/google': { | ||
subsets: ['latin'], | ||
fontLoaders: [ | ||
{ | ||
loader: '@next/font/google', | ||
options: { subsets: ['latin'] }, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |