No description
Find a file
Tobias Koppers 3f11815b02
avoid merging global css in a way that leaks into other chunk groups (#67373)
### What?

This disallows merging of global css with styles that appear on other
pages/chunk groups.

### Why?

Before we made the assumption that all CSS is written in a way that it
only affects the elements it should really affect.

In general writing CSS in that way is recommended. In App Router styles
are only added and never removed. This means when a user uses
client-side navigations to navigate the application, styles from all
previous pages are still active on the current page. To avoid visual
artefacts one need to write CSS in a way that it only affects certain
elements. Usually this can be archived by using class names. CSS Modules
even enforce this recommendation.

Assuming that all styles are written this way allows to optimize CSS
loading as request count can be reduced when (small) styles are merged
together.

But turns out that some applications are written differently. They use
global styles that are not scoped to a class name (e. g. to `body`
directly instead) and use them in different sections of the application.
They are structured in a way that doesn't allow client-side navigations
between these sections. This should be valid too, which makes our
assumption not always holding true.

This PR changes the algorithm so we only make that assumption for CSS
Modules, but not for global CSS. While this affects the ability to
optimize, applications usually do not use too much global CSS files, so
that can be accepted.

fixes #64773
2024-07-05 03:33:02 -07:00
.cargo Use rust-lld for Windows on arm64 (#66360) 2024-05-31 16:00:01 -07:00
.config Update teamname in codeowners (#57775) 2023-10-31 12:33:13 +00:00
.devcontainer fix: Update docker base images to node:20 (#66702) 2024-06-10 16:40:26 +02:00
.github Bump minimum Node.js version to 18.18 (up from 18.17) (#67274) 2024-07-05 09:21:57 +00:00
.husky refactor: remove unnecessary lint-staged operations (#65861) 2024-05-30 00:56:30 +00:00
.vscode chore: replace deprecated jest.autoRun in .vscode/settings.json (#66609) 2024-06-18 07:16:55 -07:00
bench Run and report benchmarks (#66851) 2024-06-18 11:11:15 -07:00
contributing Persist package tarballs as GitHub Actions artifacts (#66445) 2024-07-02 15:18:45 +00:00
docs [docs] Update options in create-next-app (#67455) 2024-07-04 12:41:44 +00:00
errors docs: update code block filename in dynamic API context error page (#67000) 2024-06-19 10:20:30 +00:00
examples Fix Dead Links in @neshca/cache-handler-redis example README.md (#67415) 2024-07-04 15:35:15 +00:00
packages avoid merging global css in a way that leaks into other chunk groups (#67373) 2024-07-05 03:33:02 -07:00
patches [Memory] Add option to reduce memory usage caused by duplicate strings in webpack-sources (#66003) 2024-05-22 15:30:05 -05:00
scripts Persist package tarballs as GitHub Actions artifacts (#66445) 2024-07-02 15:18:45 +00:00
test avoid merging global css in a way that leaks into other chunk groups (#67373) 2024-07-05 03:33:02 -07:00
turbo/generators fix(generators): update errors gen (#60233) 2024-01-04 20:22:21 +01:00
.alexignore Integrate next-* crates from Turbopack (#47019) 2023-03-13 14:33:17 +01:00
.alexrc docs: Add "special" to the Alex allowlist (#48021) 2023-04-06 16:32:06 +02:00
.eslintignore Add bench application with heavy dependencies (#66564) 2024-06-12 15:05:47 +02:00
.eslintrc.json [lint] Allow lint warnings to pass in CI (#66140) 2024-06-10 12:57:46 -07:00
.git-blame-ignore-revs chore: add git blame ignore-revs support to gitlens for vscode configuration (#65762) 2024-05-14 14:18:10 -07:00
.gitattributes chore: update gitattributes with linguist-vendored (#54683) 2023-08-28 21:50:19 +00:00
.gitignore ci: report daily turbo integration test results from this repo (#58965) 2023-12-04 16:18:42 +01:00
.node-version Update .node-version (#56460) 2023-10-05 07:40:12 +00:00
.npmrc chore: update pnpm to 9.4.0 (#64945) 2024-06-28 04:41:35 -07:00
.prettierignore chore: update prettier to 3.2.5 (#65092) 2024-05-08 21:47:14 +02:00
.prettierrc.json chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
.rustfmt.toml build(cargo): move workspaces manifest to top level (#48198) 2023-04-19 18:38:36 +02:00
azure-pipelines.yml Bump minimum Node.js version to 18.18 (up from 18.17) (#67274) 2024-07-05 09:21:57 +00:00
Cargo.lock Turbopack + Relay: correctly implement artifact_directory to fix multi-project test (#67403) 2024-07-04 14:52:45 +00:00
Cargo.toml Turbopack + Relay: correctly implement artifact_directory to fix multi-project test (#67403) 2024-07-04 14:52:45 +00:00
CODE_OF_CONDUCT.md updated code of conduct to v2.1 (#34208) 2022-02-10 18:11:42 -06:00
contributing.md chore: improve repo templates (#46629) 2023-03-01 09:25:51 -08:00
jest.config.js test: use replay jest runner to add current test name to recording (#60438) 2024-01-10 10:31:32 +01:00
jest.replay.config.js Add Replay integration for dev e2e tests (#40955) 2022-09-29 14:45:10 -07:00
lerna.json v15.0.0-canary.55 2024-07-04 23:23:21 +00:00
license.md chore: update Copyright time from 2023 to 2024 (#60071) 2024-01-02 11:06:02 -08:00
lint-staged.config.js refactor: simplified lint-staged config (#66720) 2024-06-11 08:51:53 -07:00
package.json Bump minimum Node.js version to 18.18 (up from 18.17) (#67274) 2024-07-05 09:21:57 +00:00
pnpm-lock.yaml Bump minimum Node.js version to 18.18 (up from 18.17) (#67274) 2024-07-05 09:21:57 +00:00
pnpm-workspace.yaml Remove next-dev and its test suite and benchmarks (#55983) 2023-09-26 05:22:39 +02:00
readme.md Monorepo (#5341) 2018-10-01 01:02:10 +02:00
release.js chore: update labels in workflows/templates (#63713) 2024-04-17 14:28:51 +02:00
run-tests.js Add dry and local options for run-tests.js (#67058) 2024-06-20 17:11:25 +02:00
rust-toolchain.toml Update rust toolchain to nightly-2024-05-31 (#66428) 2024-06-01 03:37:04 +00:00
socket.yaml chore(ci): add socket.yaml (#54446) 2023-08-23 18:12:51 +00:00
test-file.txt Add additional file serving tests (#12479) 2020-05-04 11:58:19 -05:00
tsconfig-tsec.json Integrate tsec into the linting process (#33746) 2022-02-24 16:59:18 -08:00
tsconfig.json Upgrade TypeScript to v5.5.2 (#67113) 2024-07-04 10:03:46 +02:00
tsec-exemptions.json next/script: Correctly apply async and defer props (#52939) 2024-04-15 15:01:50 -07:00
turbo.json chore: bump turbo to 2.0.3 (#66784) 2024-06-12 19:31:42 +00:00
UPGRADING.md docs: update broken link in UPGRADING.md (#60342) 2024-01-06 14:46:07 -08:00
vercel.json Silence GH Comments for Preview URLs (#18766) 2020-11-03 21:59:47 +00:00

Next.js

Getting Started

Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Community

The Next.js community can be found on GitHub Discussions where you can ask questions, voice ideas, and share your projects with other people.

To chat with other community members you can join the Next.js Discord server.

Do note that our Code of Conduct applies to all Next.js community channels. Users are highly encouraged to read and adhere to them to avoid repercussions.

Contributing

Contributions to Next.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience contributing to Next.js.

Good First Issues:

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.

Authors

A list of the original co-authors of Next.js that helped bring this amazing framework to life!


Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and NOT open a public issue. We will investigate all legitimate reports. Email security@vercel.com to disclose any security vulnerabilities. Alternatively, you can visit this link to know more about Vercel's security and report any security vulnerabilities.