Skip to content

Commit

Permalink
modify global css import error message (vercel#14639)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysun62 authored and rokinsky committed Jul 11, 2020
1 parent a028296 commit cacfd77
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 cacfd77

Please sign in to comment.