Skip to content

perf(next-swc): Remove needless JSON conversion #80671

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

Merged
merged 6 commits into from
Jun 21, 2025
Merged

perf(next-swc): Remove needless JSON conversion #80671

merged 6 commits into from
Jun 21, 2025

Conversation

kdy1
Copy link
Contributor

@kdy1 kdy1 commented Jun 19, 2025

@kdy1 kdy1 requested a review from a team June 19, 2025 00:44
@ijjk ijjk added created-by: Turbopack team PRs by the Turbopack team. Rspack Turbopack Related to Turbopack with Next.js. type: next labels Jun 19, 2025
@ijjk
Copy link
Member

ijjk commented Jun 19, 2025

Failing test suites

Commit: d48f478

pnpm test test/integration/server-side-dev-errors/test/index.test.js(rspack)

  • server-side dev errors > should show server-side error for dynamic api route correctly
Expand output

● server-side dev errors › should show server-side error for dynamic api route correctly

expect(received).toStartWith(expected)

Expected string to start with:
  "⨯ ReferenceError: missingVar is not defined

  at handler (../../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js:2:2)
      at"
  Received:
    "⚠ Fast Refresh had to perform a full reload due to a runtime error.
   ⨯ ReferenceError: missingVar is not defined
  at handler (../../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js:2:2)
  at async Module.handler (../../packages/next/dist/build/webpack/loaders/next-route-loader/index.js?kind=PAGES_API&page=%2Fapi%2Fblog%2F%5Bslug%5D&preferredRegion=&absolutePagePath=.%2Fpages%2Fapi%2Fblog%2F%5Bslug%5D.js&middlewareConfigBase64=e30%3D!:100:0)
    1 | export default function handler(req, res) {
  > 2 |   missingVar;res.status(200).json({ slug: req.query.slug })
      |  ^
    3 | }
    4 | {
    page: '/api/blog/[slug]'
  }"
  at Object.toStartWith (integration/server-side-dev-errors/test/index.test.js:310:30)

Read more about building and testing Next.js in contributing.md.

pnpm test-start test/e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts

  • segment cache (revalidation) > evict client cache when Server Action calls revalidatePath
Expand output

● segment cache (revalidation) › evict client cache when Server Action calls revalidatePath

thrown: "Exceeded timeout of 120000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  50 |   })
  51 |
> 52 |   it('evict client cache when Server Action calls revalidatePath', async () => {
     |   ^
  53 |     let act: ReturnType<typeof createRouterAct>
  54 |     const browser = await next.browser('/', {
  55 |       beforePageLoad(page) {

  at it (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:52:3)
  at Object.describe (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:7:1)

Read more about building and testing Next.js in contributing.md.

@kdy1 kdy1 marked this pull request as draft June 19, 2025 00:49
@kdy1 kdy1 self-assigned this Jun 19, 2025
@kdy1 kdy1 marked this pull request as ready for review June 19, 2025 01:06
@kdy1 kdy1 enabled auto-merge (squash) June 19, 2025 01:06
Copy link

codspeed-hq bot commented Jun 19, 2025

CodSpeed Performance Report

Merging #80671 will not alter performance

Comparing kdy1/minify-json (d48f478) with canary (ac0888f)

Summary

✅ 12 untouched benchmarks

};

use crate::{get_compiler, util::MapErr};

pub struct MinifyTask {
c: swc_core::base::Compiler,
code: MinifyTarget,
code: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an option? What's the point in minifying if you don't pass any code to minify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do get &mut self instead of self by the trait definition

@kdy1 kdy1 merged commit 1f47f8f into canary Jun 21, 2025
282 of 289 checks passed
@kdy1 kdy1 deleted the kdy1/minify-json branch June 21, 2025 04:58
@github-actions github-actions bot added the locked label Jul 7, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
created-by: Turbopack team PRs by the Turbopack team. locked Rspack Turbopack Related to Turbopack with Next.js. type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants