From 2ef496c8c83bb7bcb3afaa0d1456669193f892f0 Mon Sep 17 00:00:00 2001
From: keepview <35088742+keepview@users.noreply.github.com>
Date: Thu, 28 Nov 2024 12:01:31 +0800
Subject: [PATCH] feat: bff doc add shared source (#6575)
---
.changeset/fast-frogs-accept.md | 7 +++++++
.../docs/en/guides/advanced-features/bff/function.mdx | 6 +++++-
.../docs/zh/guides/advanced-features/bff/function.mdx | 6 +++++-
3 files changed, 17 insertions(+), 2 deletions(-)
create mode 100644 .changeset/fast-frogs-accept.md
diff --git a/.changeset/fast-frogs-accept.md b/.changeset/fast-frogs-accept.md
new file mode 100644
index 000000000000..cc9925a6cf40
--- /dev/null
+++ b/.changeset/fast-frogs-accept.md
@@ -0,0 +1,7 @@
+---
+'@modern-js/main-doc': patch
+---
+
+feat: bff doc add shared source
+
+feat: bff 文档增加共享源码
diff --git a/packages/document/main-doc/docs/en/guides/advanced-features/bff/function.mdx b/packages/document/main-doc/docs/en/guides/advanced-features/bff/function.mdx
index 59441f6dea14..b23cf27fea33 100644
--- a/packages/document/main-doc/docs/en/guides/advanced-features/bff/function.mdx
+++ b/packages/document/main-doc/docs/en/guides/advanced-features/bff/function.mdx
@@ -258,4 +258,8 @@ export default () => {
import ExtendBFF from "@site-docs-en/components/extend-bff-function"
-
\ No newline at end of file
+
+
+## Code Sharing
+
+Besides the BFF functions in the `api/` directory, which can be referenced in the `src/` directory through an integrated calling method, the `src/` and `api/` directories cannot directly reference each other's code by default. To achieve code sharing, a [`shared`](/en/apis/app/hooks/shared.html) directory can be created at the root of the project for both `src/` and `api/` to use commonly.
diff --git a/packages/document/main-doc/docs/zh/guides/advanced-features/bff/function.mdx b/packages/document/main-doc/docs/zh/guides/advanced-features/bff/function.mdx
index 59048ca6124f..dedc322cdafc 100644
--- a/packages/document/main-doc/docs/zh/guides/advanced-features/bff/function.mdx
+++ b/packages/document/main-doc/docs/zh/guides/advanced-features/bff/function.mdx
@@ -260,4 +260,8 @@ export default () => {
import ExtendBFF from "@site-docs/components/extend-bff-function"
-
\ No newline at end of file
+
+
+## 代码共享
+
+除 `api/` 目录下的 BFF 函数可在 `src/` 中通过一体化调用方式引用,项目中 `src/` 和 `api/` 目录默认不能直接引用对方代码。为实现代码共享,可在项目根目录创建 [`shared`](/apis/app/hooks/shared.html) 目录,供 `src/` 和 `api/` 共同引用。