Commit fa81a4df authored by Joe Haddad's avatar Joe Haddad Committed by JJ Kasper

Add Links to Global CSS Error (#10031)

* Add Links to Global CSS Error

* Add Example
parent b5080f10
# Global CSS Must Be in Your Custom \<App\>
#### Why This Error Occurred
An attempt to import Global CSS from a file other than [`pages/_app.js`](https://nextjs.org/docs/advanced-features/custom-app) was made.
Global CSS cannot be used in files other than your [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) due to its side-effects and ordering problems.
#### Possible Ways to Fix It
Relocate all Global CSS imports to your [`pages/_app.js` file](https://nextjs.org/docs/advanced-features/custom-app).
#### Example
```jsx
// pages/_app.js
import '../styles.css'
export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
```
# Global CSS Must Be in Your Custom <App>
#### Why This Error Occurred
An attempt to import Global CSS from a file other than `pages/_app.js` was made.
Global CSS cannot be used in files other than your Custom `<App>` due to its side-effects and ordering problems.
#### Possible Ways to Fix It
Relocate all Global CSS imports to your `pages/_app.js` file.
...@@ -7,7 +7,7 @@ export function getGlobalImportError(file: string | null) { ...@@ -7,7 +7,7 @@ export function getGlobalImportError(file: string | null) {
'Custom <App>' 'Custom <App>'
)}. Please move all global CSS imports to ${chalk.cyan( )}. Please move all global CSS imports to ${chalk.cyan(
file ? file : 'pages/_app.js' file ? file : 'pages/_app.js'
)}.\nRead more: https://err.sh/next.js/global-css` )}.\nRead more: https://err.sh/next.js/css-global`
} }
export function getGlobalModuleImportError() { export function getGlobalModuleImportError() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment