9b09b92a14
This is a follow-up to https://github.com/vercel/next.js/pull/28227 to ensure `_app` and `_document` HMR correctly when you start the dev server and then add `_app` and `_document`. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Errors have helpful link attached, see `contributing.md` x-ref: https://github.com/vercel/next.js/issues/27888
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import chalk from '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')}.`
|
|
}
|