Skip to content

Improve CSS Server Side Compilation #52208

@jantimon

Description

@jantimon

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

On Dec 15, 2022 the cache busting logic of the packages/next/src/build/webpack/loaders/next-flight-css-loader.ts was changed in 64d3ba5

Currently, despite the changes, the previous cache busting logic remains intact, leading to a suboptimal situation. There are a two reasons why this is problematic imho:

  1. Redundant Disk Reads: With the existing cache busting logic, every CSS file needs to be read from the disk once again. This results in unnecessary disk I/O operations, which can impact performance, particularly in larger applications where the number of CSS files is substantial.

  2. Unused Information: Furthermore, the information obtained through this cache busting logic is not utilized at all. This implies that the additional disk reads serve no purpose and do not contribute to the functionality or efficiency of the application.

I prepared a PR to delete the obsolete pitch loader and make use of webpacks built in resource matcher.

Could you please review the PR #51115 and provide any feedback or suggestions for further improvement?

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000

Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 3.2.3
      pnpm: N/A

Relevant packages:
      next: 13.2.4
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions