Skip to content

🔨 chore: Enable webpackBuildWorker to optimize build memory#9350

Merged
arvinxx merged 1 commit into
lobehub:mainfrom
sxjeru:patch-5
Oct 20, 2025
Merged

🔨 chore: Enable webpackBuildWorker to optimize build memory#9350
arvinxx merged 1 commit into
lobehub:mainfrom
sxjeru:patch-5

Conversation

@sxjeru

@sxjeru sxjeru commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

https://nextjs.org/docs/app/guides/memory-usage#webpack-build-worker

这边 Vercel 基本没遇到 OOC,但 Cloudflare Pages 不加该参数必定 OOC 。有待进一步测试。

📝 补充信息 | Additional Information

Summary by Sourcery

Build:

  • Enable webpackBuildWorker flag in next.config.ts to optimize build memory usage

@vercel

vercel Bot commented Sep 21, 2025

Copy link
Copy Markdown

@sxjeru is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 21, 2025
@sourcery-ai

sourcery-ai Bot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR enables Next.js's webpackBuildWorker option in next.config.ts to offload build processing to a worker thread and reduce memory usage, particularly addressing out-of-memory issues on Cloudflare Pages.

Class diagram for updated Next.js configuration options

classDiagram
  class NextConfig {
    +serverMinification: boolean
    +webVitalsAttribution: string[]
    +webpackBuildWorker: boolean
    +webpackMemoryOptimizations: boolean
    +headers(): Promise<any>
  }
Loading

File-Level Changes

Change Details Files
Enabled webpackBuildWorker to optimize build memory usage
  • Added webpackBuildWorker: true under experimental settings
next.config.ts

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@lobehubbot

Copy link
Copy Markdown
Member

👍 @sxjeru

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@gru-agent

gru-agent Bot commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 9c7f091 🚫 Skipped No files need to be tested {"next.config.ts":"File path does not match include patterns."}

History Assignment

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Sep 21, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.75%. Comparing base (a78fc1f) to head (9c7f091).
⚠️ Report is 336 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #9350     +/-   ##
=========================================
  Coverage   79.75%   79.75%             
=========================================
  Files         822      822             
  Lines       53141    53141             
  Branches     7120     5759   -1361     
=========================================
  Hits        42382    42382             
  Misses      10759    10759             
Flag Coverage Δ
app 78.15% <ø> (ø)
database 98.29% <ø> (ø)
packages/agent-runtime 62.53% <ø> (ø)
packages/context-engine 62.29% <ø> (ø)
packages/electron-server-ipc 93.76% <ø> (ø)
packages/file-loaders 88.00% <ø> (ø)
packages/model-bank 100.00% <ø> (ø)
packages/model-runtime 76.91% <ø> (ø)
packages/prompts 100.00% <ø> (ø)
packages/utils 94.81% <ø> (ø)
packages/web-crawler 97.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 71.97% <ø> (ø)
Services 62.39% <ø> (ø)
Server 65.15% <ø> (ø)
Libs 51.60% <ø> (ø)
Utils 75.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sxjeru

sxjeru commented Oct 18, 2025

Copy link
Copy Markdown
Contributor Author

Additional information on Vercel build memory usage. The first two items have the webpackBuildWorker feature enabled, the third item does not have it enabled and the build failed due to OOM.

image

This comment was translated by Claude.

Original Content Vercel 构建内存占用信息补充。前两项为启用 `webpackBuildWorker` 特性,第三项未启用,因 OOM 构建失败。 image

@arvinxx arvinxx merged commit 12f5475 into lobehub:main Oct 20, 2025
29 of 32 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @sxjeru ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

@sxjeru sxjeru deleted the patch-5 branch October 20, 2025 02:47
@lobehubbot

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.139.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dosubot dosubot Bot mentioned this pull request Dec 27, 2025
4 tasks
fleetof pushed a commit to fleetof/diggo-chat-x that referenced this pull request May 13, 2026
arvinxx added a commit that referenced this pull request May 14, 2026
…ession (#14804)

Vite 8.0.13 bumps rolldown to 1.0.1, which ships a new
chunk-optimization dedupe pass (rolldown #9305) with an unsound
sibling-dynamic-entry handling — see rolldown #9350 (open). This
causes preload-deps entries (m.f in __vite__mapDeps) to be dropped,
leaving null slots; at runtime any dynamic import that hits the
shrunken table fires import(null) and throws "Failed to resolve
module specifier 'null'", taking down every tRPC call that flows
through src/libs/trpc/client/lambda.ts headers (await import('@/services/_auth')).

Because the repo runs with lockfile=false + resolution-mode=highest,
^8.0.9 silently floats to 8.0.13 on every fresh Vercel build. Pin
exactly to 8.0.12 (which uses rolldown 1.0.0) until rolldown 1.0.2 /
Vite 8.0.14 lands a fix.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bbbugg pushed a commit to bbbugg/lobe-chat that referenced this pull request May 16, 2026
…ession (lobehub#14804)

Vite 8.0.13 bumps rolldown to 1.0.1, which ships a new
chunk-optimization dedupe pass (rolldown lobehub#9305) with an unsound
sibling-dynamic-entry handling — see rolldown lobehub#9350 (open). This
causes preload-deps entries (m.f in __vite__mapDeps) to be dropped,
leaving null slots; at runtime any dynamic import that hits the
shrunken table fires import(null) and throws "Failed to resolve
module specifier 'null'", taking down every tRPC call that flows
through src/libs/trpc/client/lambda.ts headers (await import('@/services/_auth')).

Because the repo runs with lockfile=false + resolution-mode=highest,
^8.0.9 silently floats to 8.0.13 on every fresh Vercel build. Pin
exactly to 8.0.12 (which uses rolldown 1.0.0) until rolldown 1.0.2 /
Vite 8.0.14 lands a fix.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vercel deployment build failed (out of memory)

3 participants