Unverified Commit a8d2c1ee authored by Yang Sun's avatar Yang Sun Committed by GitHub

modify global css import error message (#14639)

Fixes #14464
parent ab701071
...@@ -10,6 +10,8 @@ Global CSS cannot be used in files other than your [Custom `<App>`](https://next ...@@ -10,6 +10,8 @@ Global CSS cannot be used in files other than your [Custom `<App>`](https://next
Relocate all Global CSS imports to your [`pages/_app.js` file](https://nextjs.org/docs/advanced-features/custom-app). Relocate all Global CSS imports to your [`pages/_app.js` file](https://nextjs.org/docs/advanced-features/custom-app).
Or, [update your component to use local CSS (Component-Level CSS) via CSS Modules](https://nextjs.org/docs/basic-features/built-in-css-support#adding-component-level-css). This is the preferred approach.
#### Example #### Example
```jsx ```jsx
......
...@@ -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/css-global` )}. Or convert the import to Component-Level CSS (CSS Modules).\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