# @appshell/react-shell 中文文档

规范地址：https://npmcn.com/package/%40appshell/react-shell/

版本：1\.0\.0-alpha\.148
npm 元数据更新时间：2026-10-29T16:06:49.244Z
中文译文更新时间：2026-11-06T12:32:11.463Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40appshell/react-shell
原文对照：https://npmcn.com/package/%40appshell/react-shell/?lang=original
项目主页：https://github.com/appshellhq/appshell#readme
源码仓库：https://github.com/appshellhq/appshell

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：4.1 MB，46 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：0 个
- 首次发布：2026-08-18T05:19:56.212Z
- 最新版本发布：2026-10-29T16:06:44.372Z
- 近 30 天下载量：5888（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：138（近 12 个月 138 个）

## 中文简介

Appshell shell 捆绑反应

## 安装

```sh
npm install @appshell/react-shell
```

也可以使用：`pnpm add @appshell/react-shell`、`yarn add @appshell/react-shell`、`bun add @appshell/react-shell`

## README

[![appshell](https://github.com/appshell-org/appshell/blob/main/assets/branding/appshell-logo_2x.png)](https://github.com/appshell-org/appshell)

[![Appshell CI](https://github.com/appshell-org/appshell/actions/workflows/pipeline.yml/badge.svg)](https://github.com/appshell-org/appshell/actions/workflows/pipeline.yml)

# @ appshell/ react- shell (英语)

Appshell React shell 用于与 Appshell 和 Webpack Module Federation 一起构建微前端.

工作实例可见于此 [这里](https://github.com/appshell-org/appshell/tree/main/examples)。 。 。 .

`@appshell/react-shell` 是挂载您微前端的浏览器捆绑 。 它不是一个服务器—— appshell 注册程序使 shell 文档, 将解析的构成线入, 并为它服务 在 URL 上捆绑一个应用程序 `shellBundleUrl` 点数.

**打造微前端?. 你不需要这个包裹.** 运行自己的 dev 服务器并发布到 应用程序; 注册员为您装入 shell 捆绑。 这个读取器是用来打包的 用于操作捆绑本身.

## 选择捆绑

每个应用程序都会解决一个外壳捆绑. 默认是登记图像的船,所以 没什么可配置的。 点 `shellBundleUrl` 在其它地方将一个版本或服务从CDN上绑上:

```bash
appshell app create my-env --shell-bundle-url https://cdn.example.com/appshell/1.2.3/main.js
```

软件包发布 `dist/` 因此,一个注册图像可以在一个版本下服务 路径和指针成为普通的依赖突起:

```dockerfile
RUN npm install @appshell/react-shell@1.2.3
RUN cp -R node_modules/@appshell/react-shell/dist public/shell
```

## 正在处理捆绑

`npm start` 服务 `main.js` - 登记员还是做壳的,所以你开发 和部署时的相同 登记册不必是本地的: `shellBundleUrl` 实值 由浏览器解决,所以共享注册可以指向您的机器.

```bash
npm start
appshell app create shell-dev --ephemeral --shell-bundle-url http://localhost:3030/main.js
```

> **说明** 克罗姆和火花 `localhost` 作为一个可靠的来源,所以 `https` 登记册可能装入 `http` 从它捆起来。 Safari更严格——在当地进行登记或服务 `main.js` 超过TLS.

## 应用程序配置

注册提供根远程,它的道具, 和页面的标题,颜色, 外观和样式表,将它们嵌入它所服务的文件。 什么都没有发生 从这个包的环境 更多的.

这里剩下的是dev服务器和CLI配置:

```sh
# Port the bundle's development server listens on
APPSHELL_PORT=3030
# Registry to publish and activate against
APPSHELL_REGISTRY=
# Credential for that registry
APPSHELL_API_KEY=
```

## 在根远程挂载前填充页面的

没有,现在。 外壳不会回落: 何以覆盖空隙而根会 获取远程是应用程序的业务, 它不能来自根 包本身——这个包是等待的东西。 它必须来自 记录登记处制作的文件.

用来运载一 `Splash` 组件,通过两个 env vars 配置 当注册人接管页面渲染时,它停止了访问浏览器,所以它已经 一段时间以来,一直在渲染其硬码回落颜色。 它被移除,而不是 重新接线:在文档的首次涂料上涂上一幅文档级别的喷出涂料,而不是之后 贝壳捆绑下载、解析和挂载回放,可以按 应用程序而不是此软件包.

内部遥控器没有受到影响—— `RemoteSlot` 使用一个 `fallback` 道具,这一直是 是消费者的供给.

## 常见问题

### @appshell/react-shell 是什么？

Appshell shell 捆绑反应

### 如何安装 @appshell/react-shell？

在项目目录运行 npm install @appshell/react-shell，或使用 pnpm add / yarn add / bun add。

### @appshell/react-shell 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/appshell\_\_react-shell 是否存在。

### @appshell/react-shell 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @appshell/react-shell 可以商用吗？

@appshell/react-shell 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @appshell/react-shell 的下载量有多少？

根据 npm 官方下载统计，@appshell/react-shell 在 2026/10/07 – 2026/11/05 这 30 天内被下载 5,888 次，日均约 196 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @appshell/react-shell 还在维护吗？

最新版本 1\.0\.0-alpha\.148 发布于 2026/10/30（9 天前）；至今共发布 138 个版本，其中过去 12 个月发布了 138 个；首次发布于 2026/08/18。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

