请问如何将此应用编译成静态网页,使用客户端渲染? #34

Closed
opened 2026-02-16 10:15:54 -05:00 by yindo · 2 comments
Owner

Originally created by @CliffHan on GitHub (Jun 13, 2024).

我想要将此应用编译成一个静态的网页,去掉其原有的 api,使用自己的后端 api 替代。

这样前端就无需发送 app_id 和 api_key,这些信息保存在自己的后端服务器,根据后端设置决定是否允许前端请求。

但如果我在 next.config.js 中加上 output: 'export' 后,npx run build 报错:

Build error occurred
Error: Page "/api/conversations/[conversationId]/name" is missing "generateStaticParams()" so it cannot be used with "output: export" config.

去掉 app/api 目录后,编译还是报错:
Generating static pages (0/4) [== ]a [Error]: Page with dynamic = "error" couldn't be rendered statically because it used cookies.

能否指导一下这个需求如何实现?谢谢。

Originally created by @CliffHan on GitHub (Jun 13, 2024). 我想要将此应用编译成一个静态的网页,去掉其原有的 api,使用自己的后端 api 替代。 这样前端就无需发送 app_id 和 api_key,这些信息保存在自己的后端服务器,根据后端设置决定是否允许前端请求。 但如果我在 next.config.js 中加上 output: 'export' 后,npx run build 报错: > Build error occurred Error: Page "/api/conversations/[conversationId]/name" is missing "generateStaticParams()" so it cannot be used with "output: export" config. 去掉 app/api 目录后,编译还是报错: Generating static pages (0/4) [== ]a [Error]: Page with `dynamic = "error"` couldn't be rendered statically because it used `cookies`. 能否指导一下这个需求如何实现?谢谢。
yindo closed this issue 2026-02-16 10:15:54 -05:00
Author
Owner

@hesangang commented on GitHub (Aug 14, 2024):

可以考虑使用nginx做前后端代理,/api请求代理到你的后端服务

@hesangang commented on GitHub (Aug 14, 2024): 可以考虑使用nginx做前后端代理,/api请求代理到你的后端服务
Author
Owner

@marsDes commented on GitHub (Feb 27, 2025):

接口调用不要用 dify-client,把api目录去掉
直接调用后端的api 由后端去调用dify的接口

@marsDes commented on GitHub (Feb 27, 2025): 接口调用不要用 dify-client,把api目录去掉 直接调用后端的api 由后端去调用dify的接口
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/webapp-conversation#34