@atlaspack/transformer-babel

中文文档
2.15.26发布于 2026/09/16(MIT OR Apache-2.0)TypeScriptCommonJS近 30 天下载 2794

This Atlaspack transformer plugin is responsible for transforming assets with Babel. It uses @babel/core to resolve babel config the same way Babel does and uses that if found. If no filesystem config is found it uses a default config that supports the

原始使用文档

@atlaspack/transformer-babel

This Atlaspack transformer plugin is responsible for transforming assets with Babel. It uses @babel/core to resolve babel config the same way Babel does and uses that if found. If no filesystem config is found it uses a default config that supports the most common cases.

Default config

  • @babel/preset-env - Uses the targets defined in package.json or a default set of targets if none are defined to pass to @babel/preset-env as options. It runs over all source code as well as installed packages that have a browserslist with higher targets than the app being built by Atlaspack.
  • @babel/plugin-flow-strip-types - Right now it configures the flow plugin which uses the ast to check if there is a flow directive and strips types if so [TODO: It should do a cheap check of the code and only apply the plugin if a flow directive is found as it may affect parsing when it shouldn't]
  • @babel/plugin-transform-typescript - Configured for files with extenions .ts and .tsx
  • @babel/plugin-transform-react-jsx - Configured if file has extension .jsx or if a React like dependency is found as a dependency in package.json.

Custom config perf warnings

Atlaspack now supports all configuration formats that Babel supports, but some of them come with negative performance impacts.

  • babel.config.js/.babelrc.js - Since Babel 7, config files as JS are now supported. While this provides flexibility it hurts cacheability. Atlaspack cannot cache using the contents of the these files because the config they return is non deterministic based on content alone. Imported dependencies may change or the results may be based on environment variables. For this reason Atlaspack has to resolve load these files on each build and make sure their output is still the same. Another downside to using JS config files is that they end up being require()ed by Babel so Atlaspack cannot rebuild when the file changes in watch mode. To avoid these performance penalties, it is suggested that you use a babel.config.json or .babelrc file instead.
  • require('@babel') - With the advent of JS config files, it is now possible to directly require presets and plugins in configs instead of using names or paths that are resolved by Babel. Unfortunately this gives Atlaspack no information about which plugins/presets were used in a transformation so Atlaspack will be forced to run the Babel transformations on every build. It is suggested to avoid this type of configuration.

版本与发布记录

@atlaspack/transformer-babel 共发布 1,060 个版本,首次发布于 2024/08/20;过去 12 个月发布了 252 个版本。

版本发布日期距今
2.15.26latest2026/09/161 个月前
2.14.5-canary.5002026/09/161 个月前
2.14.5-canary.4992026/09/151 个月前
2.14.5-canary.4932026/07/163 个月前
2.14.5-canary.4922026/07/153 个月前
2.15.252026/06/224 个月前

其他发布通道:alshdevreleasescript → 2.14.15-alshdevreleasescript.0,alshintegrationtestslib → 2.14.15-alshintegrationtestslib.0,unified → 2.14.18-unified-f165f7d09.0,noselfbuild → 2.14.18-noselfbuild-63bde801d.0,typescript → 2.14.22-typescript-17c3d1dec.0,dev-inline-requires-reuse → 2.14.26-dev-inline-requires-reuse-bdc9ca9c3.0。

关于 @atlaspack/transformer-babel 的常见问题

@atlaspack/transformer-babel 是什么?

This Atlaspack transformer plugin is responsible for transforming assets with Babel. It uses @babel/core to resolve babel config the same way Babel does and uses that if found. If no filesystem config is found it uses a default config that supports the

如何安装 @atlaspack/transformer-babel?

在项目目录运行 npm install @atlaspack/transformer-babel,或使用 pnpm add / yarn add / bun add。

@atlaspack/transformer-babel 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atlaspack/transformer-babel 支持 ESM 还是 CommonJS?

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

@atlaspack/transformer-babel 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 16.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@atlaspack/transformer-babel 可以商用吗?

@atlaspack/transformer-babel 使用 (MIT OR Apache-2.0) 许可。可在 MIT、Apache-2.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@atlaspack/transformer-babel 的下载量有多少?

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

@atlaspack/transformer-babel 还在维护吗?

最新版本 2.15.26 发布于 2026/09/16(1 个月前);至今共发布 1060 个版本,其中过去 12 个月发布了 252 个;首次发布于 2024/08/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。