Skip to content

Commit

Permalink
modify global css import error message (#14639)
Browse files Browse the repository at this point in the history
Fixes #14464
  • Loading branch information
ysun62 authored Jun 30, 2020
1 parent ab70107 commit a8d2c1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions errors/css-global.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

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

```jsx
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/config/blocks/css/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function getGlobalImportError(file: string | null) {
'Custom <App>'
)}. Please move all global CSS imports to ${chalk.cyan(
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() {
Expand Down

0 comments on commit a8d2c1e

Please sign in to comment.