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 (#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
Hannes Bornö
committed
Oct 7, 2022
1 parent
f83cc0c
commit b559002
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'] }, | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
b559002
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stats from current release
Default Build (Increase detected⚠️ )
General Overall increase⚠️
Page Load Tests Overall decrease⚠️
Client Bundles (main, webpack) Overall increase⚠️
Legacy Client Bundles (polyfills)
Client Pages Overall decrease ✓
Client Build Manifests Overall increase⚠️
Rendered Page Sizes Overall increase⚠️
Edge SSR bundle Size Overall decrease ✓
Middleware size Overall decrease ✓
Diffs
Diff for page.js
Diff for edge-runtime-webpack.js
Diff for middleware-b..-manifest.js
Diff for middleware-r..-manifest.js
Diff for middleware.js
Diff too large to display
Diff for edge-ssr.js
Diff too large to display
Diff for _buildManifest.js
Diff for _app-HASH.js
Diff for _error-HASH.js
Diff for amp-HASH.js
Diff for css-HASH.js
Diff for dynamic-HASH.js
Diff for edge-ssr-HASH.js
Diff for head-HASH.js
Diff for hooks-HASH.js
Diff for image-HASH.js
Diff for index-HASH.js
Diff for link-HASH.js
Diff for routerDirect-HASH.js
Diff for script-HASH.js
Diff for withRouter-HASH.js
Diff for 575-HASH.js
Diff too large to display
Diff for 719.HASH.js
Diff for app-internals-HASH.js
Diff for page-25c20a36bd5af608.js
Diff for page-e0b090e870162898.js
Diff for framework-HASH.js
Diff for main-HASH.js
Diff too large to display
Diff for main-app-HASH.js
Diff too large to display
Diff for webpack-HASH.js
Diff for index.html
Diff for link.html
Diff for withRouter.html
Default Build with SWC (Increase detected⚠️ )
General Overall increase⚠️
Page Load Tests Overall increase ✓
Client Bundles (main, webpack) Overall increase⚠️
Legacy Client Bundles (polyfills)
Client Pages Overall decrease ✓
Client Build Manifests Overall increase⚠️
Rendered Page Sizes Overall increase⚠️
Edge SSR bundle Size Overall decrease ✓
Middleware size Overall decrease ✓
Diffs
Diff for page.js
Diff for edge-runtime-webpack.js
Diff for middleware-b..-manifest.js
Diff for middleware-r..-manifest.js
Diff for middleware.js
Diff too large to display
Diff for edge-ssr.js
Diff too large to display
Diff for _buildManifest.js
Diff for _app-HASH.js
Diff for _error-HASH.js
Diff for amp-HASH.js
Diff for css-HASH.js
Diff for dynamic-HASH.js
Diff for edge-ssr-HASH.js
Diff for head-HASH.js
Diff for hooks-HASH.js
Diff for image-HASH.js
Diff for index-HASH.js
Diff for link-HASH.js
Diff for routerDirect-HASH.js
Diff for script-HASH.js
Diff for withRouter-HASH.js
Diff for 575-HASH.js
Diff too large to display
Diff for 719.HASH.js
Diff for app-internals-HASH.js
Diff for page-25c20a36bd5af608.js
Diff for page-e0b090e870162898.js
Diff for framework-HASH.js
Diff for main-HASH.js
Diff too large to display
Diff for main-app-HASH.js
Diff too large to display
Diff for webpack-HASH.js
Diff for index.html
Diff for link.html
Diff for withRouter.html