chore: add Cloudflare Pages API proxy and fix build dependency resolution#27
Merged
web-ppanel merged 1 commit intoperfect-panel:mainfrom Mar 12, 2026
Merged
chore: add Cloudflare Pages API proxy and fix build dependency resolution#27web-ppanel merged 1 commit intoperfect-panel:mainfrom
web-ppanel merged 1 commit intoperfect-panel:mainfrom
Conversation
✅ Deploy Preview for ppane-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
🎉 This PR is included in version 1.3.15 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
fix: Cloudflare Pages 构建与 API 代理支持 / Cloudflare Pages build compatibility & API proxy
本次变更解决了在 Cloudflare Pages 环境下部署时遇到的依赖解析和跨域请求问题,具体包含以下三项改动:
新增
bunfig.toml将 Bun 的包安装模式设置为
hoisted(扁平化node_modules),确保 Vite/Rollup 在 Cloudflare Pages CI 环境中能正确解析依赖。显式声明 React 依赖
在
apps/admin和apps/user的package.json中分别添加react@^19.2.0和react-dom@^19.2.0,避免 hoisted 模式下因隐式依赖提升失败导致构建报错。新增 Cloudflare Pages API 代理
functions/v1/[[path]].ts实现了一个 Cloudflare Pages Function,将
/v1/**路径的请求透明转发至后端(由环境变量API_BASE_URL指定),并处理 CORS 及 Cloudflare 专属请求头的清理,使前端无需额外跨域配置即可访问 API。📝 补充信息 | Additional Information
Cloudflare Pages 部署配置 / Deployment Configuration
bun install && bunx turbo build --filter=ppanel-admin-webbun install && bunx turbo build --filter=ppanel-user-webapps/admin/distapps/user/dist环境变量 Environment Variables
API_BASE_URLhttps://api.ppanel.devOPTIONS预检请求统一返回204,确保浏览器 CORS 预检正常通过。set-cookie响应头转发,避免 Cookie 属性不兼容问题。