1. 30 May, 2023 5 commits
    • vercel-release-bot's avatar
      v13.4.5-canary.2 · a4f2bbbe
      vercel-release-bot authored
      a4f2bbbe
    • Shu Ding's avatar
      Fix CSS duplication related problems (#50406) · 470e48c0
      Shu Ding authored
      This PR fixes a couple of categories of CSS issues in App Router, that
      come from the same root cause.
      
      ### 1. Duplicated styles being loaded in different layers
      
      This issue has been described in
      https://github.com/vanilla-extract-css/vanilla-extract/issues/1088#issuecomment-1563931144.
      If a CSS module (or a global CSS) is referenced in multiple layers (e.g.
      a layout and a page), it will be bundled into multiple CSS assets
      because each layer is considered as a separate entry.
      
      <img width="1141" alt="CleanShot-2023-05-26-GoB9Rhcs@2x"
      src="https://github.com/vercel/next.js/assets/3676859/8e0f5346-ee64-4553-950a-7fb44f769efc">
      
      As explained in that issue, we have to bundle all CSS modules into one
      chunk to avoid a big number of requests.
      
      ### 2. CSS ordering issues (conflicts)
      
      This is likely causing https://github.com/vercel/next.js/issues/48120.
      When the layer-based bundling and ordering logic applies to CSS, it can
      potentially cause non-deterministic order. In this example, button A in
      the layout should be in blue. However when button B is imported by the
      page, button A becomes red. This is an inconsistent experience and can
      be hard to debug and fix.
      
      <img width="1090" alt="CleanShot-2023-05-26-Ar4MN5rP@2x"
      src="https://github.com/vercel/next.js/assets/3676859/4328d5d7-23af-4c42-bedf-30f8f062d96a">
      470e48c0
    • vercel-release-bot's avatar
      v13.4.5-canary.1 · e8bf7859
      vercel-release-bot authored
      e8bf7859
    • Tobias Koppers's avatar
      disable test case for Turbopack (#50530) · ffb68e95
      Tobias Koppers authored
      ### What?
      
      This test case was never passing and accidentally enabled for Turbopack.
      
      We could disable the whole test suite, but since only one test case is
      affected we can also disable only that one.
      ffb68e95
    • Tim Neutkens's avatar
      Optimize Next.js bootup compilation (#50379) · f85b45fb
      Tim Neutkens authored
      ## What?
      
      Currently we use the initial compile to add entrypoints that we know are
      going to be used in the application. For example the Next.js runtime,
      `react`, `react-dom`, and such. While this was the right default when
      Next.js only had `pages`, it's no longer true when both `pages` and
      `app` exist. E.g. when you're working on a page using App Router we'd
      still compile `pages/_app`, `pages/_document`, and `pages/_error` even
      though those would not be used. In case of larger applications (e.g.
      Vercel's application) this would mean thousands of extra modules being
      compiled even though you don't need them for the page you're looking at.
      Similarly we'd compile the Next.js runtime for App Router even when
      you're only using `pages`.
      
      This PR changes the handling to only compile the entries that are needed
      for the current set of visited pages (on-demand-entries). If that set
      only includes `app` entrypoints then the `pages` related files will be
      excluded. If the set contains both `app` and `pages` both will be
      included. Similarly for `amp`, if you don't use `amp: true` / `amp:
      hybrid` the development runtime will not be compiled.
      
      📔 Note: This is specifically for webpack, Turbopack already compiles
      everything needed lazily so it didn't have this limitation.
      
      #### Before
      
      ```
      - event compiled client and server successfully in 1079 ms (306 modules)
      - event compiled client and server successfully in 155 ms (306 modules)
      ```
      
      With opening `/`:
      
      ```
      - event compiled client and server successfully in 1118 ms (306 modules)
      - event compiled client and server successfully in 157 ms (306 modules)
      - event compiled client and server successfully in 599 ms (486 modules)
      ```
      
      Total: 1.874ms (Note: This number is much higher when `pages/_app`
      imports many modules).
      
      #### After
      
      ```
      - event compiled client and server successfully in 118 ms (20 modules)
      - event compiled client and server successfully in 65 ms (20 modules)
      ```
      
      📔 Note: opening the page then causes the Next.js / React runtime to be
      compiled ofcourse
      
      ```
      - event compiled client and server successfully in 115 ms (20 modules)
      - event compiled client and server successfully in 57 ms (20 modules)
      - event compiled client and server successfully in 1137 ms (361 modules)
      ```
      
      Total: 1.309ms (Note: This number is not affected by`pages/_app`
      importing many modules).
      
      ## How?
      
      We can only apply this optimization after we've looped over the list of
      on-demand entries, as that has the required metadata. Hence why I went
      with deleting the keys for each respective type of entrypoint (`pages`,
      `app`, `amp`).
      
      <!-- Thanks for opening a PR! Your contribution is much appreciated.
      To make sure your PR is handled as smoothly as possible we request that
      you follow the checklist sections below.
      Choose the right checklist for the change(s) that you're making:
      
      ## For Contributors
      
      ### Improving Documentation or adding/fixing Examples
      
      - The "examples guidelines" are followed from our contributing doc
      https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
      - Make sure the linting passes by running `pnpm build && pnpm lint`. See
      https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md
      
      ### Fixing a bug
      
      - Related issues linked using `fixes #number`
      - Tests added. See:
      https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      ### Adding a feature
      
      - Implements an existing feature request or RFC. Make sure the feature
      request has been accepted for implementation before opening a PR. (A
      discussion must be opened, see
      https://github.com/vercel/next.js/discussions/new?category=ideas)
      - Related issues/discussions are linked using `fixes #number`
      - e2e tests added
      (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
      - Documentation added
      - Telemetry added. In case of a feature if it's used or not.
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      
      
      ## For Maintainers
      
      - Minimal description (aim for explaining to someone not on the team to
      understand the PR)
      - When linking to a Slack thread, you might want to share details of the
      conclusion
      - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
      - Add review comments if necessary to explain to the reviewer the logic
      behind a change
      
      ### What?
      
      ### Why?
      
      ### How?
      
      Closes NEXT-
      Fixes #
      
      -->
      
      ---------
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      f85b45fb
  2. 29 May, 2023 2 commits
  3. 28 May, 2023 7 commits
  4. 27 May, 2023 2 commits
  5. 26 May, 2023 9 commits
  6. 25 May, 2023 15 commits