Skip to content

Fix: add ppc64le build and dev server support for frontend#2089

Open
ethanchoe-2 wants to merge 7 commits into
langflow-ai:mainfrom
afsanjar:fix-frontend-ppc64le-build
Open

Fix: add ppc64le build and dev server support for frontend#2089
ethanchoe-2 wants to merge 7 commits into
langflow-ai:mainfrom
afsanjar:fix-frontend-ppc64le-build

Conversation

@ethanchoe-2

@ethanchoe-2 ethanchoe-2 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2088

What changed

  • frontend/next.config.ts — replace __dirname with process.cwd() (fixes crash when Next.js compiles config as an ES module under the WASM runtime)
  • frontend/build.js — new arch-detection wrapper that adds --webpack flag on ppc64le
  • frontend/package.json — change build script from next build to node build.js
  • Makefile — add ppc64le arch check to make frontend dev server target, passes --webpack on Power hardware

Why

next-swc has no native bindings for linux/ppc64le. The WASM fallback compiles next.config.ts as an ES module where __dirname is undefined, crashing both the build and dev server. Forcing --webpack and using process.cwd() instead makes the build work correctly on ppc64le while remaining unchanged on x86_64 and arm64.

Summary by CodeRabbit

  • New Features

    • Added PowerPC architecture support for frontend development and production builds, including a Webpack fallback when needed.
    • Introduced an automated build launcher to select the correct build command by architecture.
  • Bug Fixes

    • Improved environment file lookup by resolving the .env path relative to the runtime working directory.
    • Preserved configured host/port behavior across development startup and build workflows.

@github-actions github-actions Bot added community frontend 🟨 Issues related to the UI/UX and removed community labels Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa0f91f3-403c-4a5a-8a4a-b8066c9b7ae7

📥 Commits

Reviewing files that changed from the base of the PR and between 6e17da9 and c7202b8.

📒 Files selected for processing (1)
  • Makefile

Walkthrough

The frontend development and production build commands now detect PowerPC architectures, use Next.js webpack fallbacks, resolve environment files from the working directory, and route npm run build through an architecture-aware Node.js launcher.

Changes

Frontend PowerPC support

Layer / File(s) Summary
Development startup and environment resolution
Makefile, frontend/next.config.ts
The development target configures absolute environment and port paths, uses port-specific output directories, selects webpack on PowerPC, and resolves the environment file from process.cwd().
Architecture-aware production build
frontend/build.js, frontend/package.json
A new build launcher selects next build --webpack for ppc64, preserves build output and exit status, and is invoked by the npm build script.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • langflow-ai/openrag#2101: Contains overlapping PowerPC frontend startup, build launcher, npm script, and environment-path changes.

Suggested labels: bug, enhancement

Suggested reviewers: lucaseduoli, mpawlow

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding ppc64le build and dev-server support for the frontend.
Linked Issues check ✅ Passed The changes address #2088 by fixing the env path and adding a ppc64le webpack fallback for build and frontend startup.
Out of Scope Changes check ✅ Passed All modified files are directly tied to the ppc64le build and dev-server fix, with no obvious unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/next.config.ts (1)

5-9: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Use path.resolve to correctly handle absolute paths.

The comment indicates that absolute ENV_FILE paths should be used as-is, and the make frontend command exports an absolute path (export ENV_FILE="$(abspath $(ENV_FILE))").

However, path.join simply concatenates path segments, meaning an absolute path like /home/user/.env will be incorrectly appended to the base path (e.g., resulting in /current/working/dir/../home/user/.env).

To respect absolute paths correctly, use path.resolve, which treats an absolute path argument as the new root.

🐛 Proposed fix
 // Load environment variables from the root env file. Honors ENV_FILE (set by
 // the Makefile) so per-instance env files like `.env.instance2` are respected;
 // defaults to `.env`. Absolute ENV_FILE paths are used as-is.
 dotenv.config({
-  path: path.join(process.cwd(), "..", process.env.ENV_FILE || ".env"),
+  path: path.resolve(process.cwd(), "..", process.env.ENV_FILE || ".env"),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/next.config.ts` around lines 5 - 9, Update the dotenv.config path
construction in the environment-loading setup to use path.resolve instead of
path.join, preserving relative ENV_FILE resolution from the parent directory
while allowing absolute ENV_FILE values to be used unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@frontend/next.config.ts`:
- Around line 5-9: Update the dotenv.config path construction in the
environment-loading setup to use path.resolve instead of path.join, preserving
relative ENV_FILE resolution from the parent directory while allowing absolute
ENV_FILE values to be used unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e89ac315-7e4c-4486-b4d7-74a7b924f1ea

📥 Commits

Reviewing files that changed from the base of the PR and between d28706a and 6cc3e94.

📒 Files selected for processing (4)
  • Makefile
  • frontend/build.js
  • frontend/next.config.ts
  • frontend/package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend 🟨 Issues related to the UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant