bb200b922d
Fix wrong links. Add specific error message if Next.js version < 13. ## 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 build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
15 lines
574 B
JavaScript
15 lines
574 B
JavaScript
// Validate next version
|
|
const semver = require('next/dist/compiled/semver')
|
|
if (semver.lt(require('next/package.json').version, '13.0.0')) {
|
|
throw new Error('`@next/font` is only available in Next.js 13 and newer.')
|
|
}
|
|
|
|
let message = '@next/font/google failed to run or is incorrectly configured.'
|
|
if (process.env.NODE_ENV === 'development') {
|
|
message +=
|
|
'\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'
|
|
}
|
|
|
|
message += `\n\nRead more: https://nextjs.org/docs/basic-features/font-optimization`
|
|
|
|
throw new Error(message)
|