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/` 共同引用。