584d842ae0
Similar to https://github.com/vercel/next.js/pull/42106. Make `@next/font` works as expected when using `transpilePackages`. Also makes sure `@next/font` is auto-configured correctly when in a monorepo. ## 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) Co-authored-by: JJ Kasper <jj@jjsweb.site>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import chalk from 'next/dist/compiled/chalk'
|
|
|
|
export function getGlobalImportError() {
|
|
return `Global CSS ${chalk.bold(
|
|
'cannot'
|
|
)} be imported from files other than your ${chalk.bold(
|
|
'Custom <App>'
|
|
)}. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to ${chalk.cyan(
|
|
'pages/_app.js'
|
|
)}. Or convert the import to Component-Level CSS (CSS Modules).\nRead more: https://nextjs.org/docs/messages/css-global`
|
|
}
|
|
|
|
export function getGlobalModuleImportError() {
|
|
return `Global CSS ${chalk.bold(
|
|
'cannot'
|
|
)} be imported from within ${chalk.bold(
|
|
'node_modules'
|
|
)}.\nRead more: https://nextjs.org/docs/messages/css-npm`
|
|
}
|
|
|
|
export function getLocalModuleImportError() {
|
|
return `CSS Modules ${chalk.bold(
|
|
'cannot'
|
|
)} be imported from within ${chalk.bold(
|
|
'node_modules'
|
|
)}.\nRead more: https://nextjs.org/docs/messages/css-modules-npm`
|
|
}
|
|
|
|
export function getCustomDocumentError() {
|
|
return `CSS ${chalk.bold('cannot')} be imported within ${chalk.cyan(
|
|
'pages/_document.js'
|
|
)}. Please move global styles to ${chalk.cyan('pages/_app.js')}.`
|
|
}
|
|
|
|
export function getFontLoaderDocumentImportError() {
|
|
return `Font loader error:\nFont loaders ${chalk.bold(
|
|
'cannot'
|
|
)} be used within ${chalk.cyan('pages/_document.js')}.`
|
|
}
|