@exodus/metro-react-native-babel-preset

中文文档
0.78.0-rc.7发布于 2026/11/09MITCommonJS近 30 天下载 1.1万

Babel preset for React Native applications

原始使用文档
文档目录4 节
  1. Usage
  2. Installation
  3. Configuring Babel
  4. Help and Support

metro-react-native-babel-preset

Babel presets for React Native applications. React Native itself uses this Babel preset by default when transforming your app's source code.

If you wish to use a custom Babel configuration by writing a babel.config.js file in your project's root directory, you must specify all the plugins necessary to transform your code. React Native does not apply its default Babel configuration in this case. So, to make your life easier, you can use this preset to get the default configuration and then specify more plugins that run before it.

Usage

As mentioned above, you only need to use this preset if you are writing a custom babel.config.js file.

Installation

Install metro-react-native-babel-preset in your app:

with npm:

npm i metro-react-native-babel-preset --save-dev

or with pnpm:

pnpm add -D metro-react-native-babel-preset

Configuring Babel

Then, create a file called babel.config.js in your project's root directory. The existence of this babel.config.js file will tell React Native to use your custom Babel configuration instead of its own. Then load this preset with the hermes-stable transform profile. The option is required:

{
  "presets": [["module:metro-react-native-babel-preset", { "unstable_transformProfile": "hermes-stable" }]]
}

You can further customize your Babel configuration by specifying plugins and other options. See Babel's babel.config.js documentation to learn more.

Help and Support

If you get stuck configuring Babel, please ask a question on Stack Overflow or find a consultant for help. If you discover a bug, please open up an issue.

版本与发布记录

@exodus/metro-react-native-babel-preset 共发布 14 个版本,首次发布于 2023/06/14;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.78.0-rc.7latest2026/11/094 天前
0.78.0-rc.62026/11/0211 天前
0.78.0-rc.52026/11/0212 天前
0.78.0-rc.42026/10/141 个月前
0.78.0-rc.32025/05/021.5 年前
0.78.0-rc.22025/04/171.6 年前

关于 @exodus/metro-react-native-babel-preset 的常见问题

@exodus/metro-react-native-babel-preset 是什么?

Babel preset for React Native applications

如何安装 @exodus/metro-react-native-babel-preset?

在项目目录运行 npm install @exodus/metro-react-native-babel-preset,或使用 pnpm add / yarn add / bun add。

@exodus/metro-react-native-babel-preset 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/exodus__metro-react-native-babel-preset 是否存在。

@exodus/metro-react-native-babel-preset 支持 ESM 还是 CommonJS?

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

@exodus/metro-react-native-babel-preset 可以商用吗?

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

@exodus/metro-react-native-babel-preset 的下载量有多少?

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

@exodus/metro-react-native-babel-preset 还在维护吗?

最新版本 0.78.0-rc.7 发布于 2026/11/09(4 天前);至今共发布 14 个版本,其中过去 12 个月发布了 4 个;首次发布于 2023/06/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。