-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Document cssChunking
option
#67691
Conversation
docs/02-app/01-building-your-application/05-styling/01-css-modules.mdx
Outdated
Show resolved
Hide resolved
docs/02-app/01-building-your-application/05-styling/01-css-modules.mdx
Outdated
Show resolved
Hide resolved
@sokra Is there a better word than "guessing" (I'm not sure if the code is really guessing per-say unless there is something like |
It's figuring out the dependencies from the import order in source code. |
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **`'loose'` (default)**: Next.js will try to merge CSS files whenever possible, determining explicit and implicit dependencies between files from import order to reduce the number of chunks and therefore the number of requests. | ||
- **`'strict'`**: Next.js will load CSS files in the correct order they are imported into your files, which can lead to more chunks and requests. | ||
|
||
You may consider using `'strict'` if you run into unexpected CSS behavior. For example, if you import `a.css` and `b.css` in different files using a different `import` order (`a` before `b`, or `b` before `a`), `'loose'` will merge the files in any other and assume there are no dependencies between them. However, if `b.css` depends on `a.css`, you may want to use `'strict'` to prevent the files from being merged, and instead, load them in the order they are imported - which can result in more chunks and requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delbaoliveira Sorry for randomly appearing in a merged PR, but I'm guessing there is a typo here.
"will merge the files in any other" should most likely be "will merge the files in any order".
## Why? Fixing `other` → `order` typo. - x-ref: #67691 (comment)
Closes: NDX-13
Related: NDX-1