Fix: add ppc64le build and dev server support for frontend#2089
Fix: add ppc64le build and dev server support for frontend#2089ethanchoe-2 wants to merge 7 commits into
Conversation
Signed-off-by: Ethan Choe <ethanchoe@ibm.com>
Signed-off-by: Ethan Choe <ethanchoe3@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe frontend development and production build commands now detect PowerPC architectures, use Next.js webpack fallbacks, resolve environment files from the working directory, and route ChangesFrontend PowerPC support
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 winUse
path.resolveto correctly handle absolute paths.The comment indicates that absolute
ENV_FILEpaths should be used as-is, and themake frontendcommand exports an absolute path (export ENV_FILE="$(abspath $(ENV_FILE))").However,
path.joinsimply concatenates path segments, meaning an absolute path like/home/user/.envwill 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
📒 Files selected for processing (4)
Makefilefrontend/build.jsfrontend/next.config.tsfrontend/package.json
Signed-off-by: Ethan Choe <ethanchoe3@gmail.com>
Fixes #2088
What changed
frontend/next.config.ts— replace__dirnamewithprocess.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--webpackflag on ppc64lefrontend/package.json— change build script fromnext buildtonode build.jsMakefile— add ppc64le arch check tomake frontenddev server target, passes--webpackon Power hardwareWhy
next-swchas no native bindings forlinux/ppc64le. The WASM fallback compilesnext.config.tsas an ES module where__dirnameis undefined, crashing both the build and dev server. Forcing--webpackand usingprocess.cwd()instead makes the build work correctly on ppc64le while remaining unchanged on x86_64 and arm64.Summary by CodeRabbit
New Features
Bug Fixes
.envpath relative to the runtime working directory.