# @chialab/rna-bundler

> A JavaScript, CSS and HTML bundler based on esbuild.

Latest version **0.19.3** (published 2026-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chialab/rna-bundler
pnpm add @chialab/rna-bundler
yarn add @chialab/rna-bundler
bun add @chialab/rna-bundler
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.19.3 |
| Published | 2026-06-24 |
| First published | 2021-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 11 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 183 |
| Author | Chialab |
| Maintainers | chialab-admin, chialab-developers |
| Keywords | bundler, webapp, esm, cjs, esbuild |

## Links

- npm: https://www.npmjs.com/package/@chialab/rna-bundler
- Repository: https://github.com/chialab/rna
- Homepage: https://github.com/chialab/rna#readme
- Issues: https://github.com/chialab/rna/issues
- npm.io page: https://npm.io/package/@chialab/rna-bundler

## Dependencies (11)

- [esbuild](https://npm.io/package/esbuild.md) ^0.21.0 || ^0.22.0 || ^0.23.0 || ^0.24.0
- [@chialab/rna-logger](https://npm.io/package/@chialab/rna-logger.md) ^0.19.1
- [@chialab/esbuild-rna](https://npm.io/package/@chialab/esbuild-rna.md) ^0.19.1
- [@chialab/rna-config-loader](https://npm.io/package/@chialab/rna-config-loader.md) ^0.19.2
- [@chialab/esbuild-plugin-env](https://npm.io/package/@chialab/esbuild-plugin-env.md) ^0.19.1
- [@chialab/esbuild-plugin-html](https://npm.io/package/@chialab/esbuild-plugin-html.md) ^0.19.1
- [@chialab/esbuild-plugin-worker](https://npm.io/package/@chialab/esbuild-plugin-worker.md) ^0.19.1
- [@chialab/esbuild-plugin-any-file](https://npm.io/package/@chialab/esbuild-plugin-any-file.md) ^0.19.1
- [@chialab/esbuild-plugin-commonjs](https://npm.io/package/@chialab/esbuild-plugin-commonjs.md) ^0.19.1
- [@chialab/esbuild-plugin-meta-url](https://npm.io/package/@chialab/esbuild-plugin-meta-url.md) ^0.19.1
- [@chialab/esbuild-plugin-metadata](https://npm.io/package/@chialab/esbuild-plugin-metadata.md) ^0.19.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.19.3 (latest) — 2026-06-24
- 0.19.0-beta.3 (beta) — 2024-11-04
- 0.18.0-alpha.1 (alpha) — 2023-08-29
- 0.19.2 — 2026-06-24
- 0.19.1 — 2026-02-25
- 0.19.0 — 2025-08-25
- 0.19.0-beta.2 — 2024-07-09
- 0.19.0-beta.1 — 2024-06-14
- 0.19.0-beta.0 — 2024-03-11
- 0.18.1 — 2024-01-23
- 0.18.0 — 2024-01-11
- 0.18.0-alpha.0 — 2023-05-01
- 0.17.6 — 2022-10-12
- 0.17.5 — 2022-10-05
- 0.17.4 — 2022-08-29
- … 174 more at https://npm.io/package/@chialab/rna-bundler/versions

## README

# RNA Bundler

A JavaScript, CSS and HTML bundler based on [esbuild](https://esbuild.github.io/).

> [!CAUTION]
> RNA cli development is deprecated and discontinued. It's recommended to use RNA plugins directly in your projects using vite, esbuild, or other supported tools.

[![NPM](https://img.shields.io/npm/v/@chialab/rna-bundler.svg)](https://www.npmjs.com/package/@chialab/rna-bundler)

## Install

The bundler is part of the `@chialab/rna` cli, but you can use it as a module.

```sh
npm i @chialab/rna-bundler -D
```

```sh
yarn add @chialab/rna-bundler -D
```

```sh
pnpm add @chialab/rna-bundler -D
```

## Usage

Compile JS and CSS modules and HTML apps using [`esbuild`](https://esbuild.github.io/). It can output multiple module formats and it can be used to build a single module or to bundle all dependencies of an application.

Please note that HTML and CSS loaders are separated plugins that needs to be installed in order to work.

### Via import

```js
import { build } from '@chialab/rna';

await build({
    input: 'index.js',
    output: 'dist/esm/index.js',
    // code: '...',
    // rootDir: '.',
    platform: 'browser' // 'node',
    format: 'esm', // 'cjs' 'iife'
    // globalName: '', // global name for iife modules
    sourcemap: true,
    minify: true,
});
```

### Via cli

```
rna build [options] [entry...]

Options:
  -C, --config <path>         the rna config file
  -O, --output <path>         output directory or file
  --format <type>             bundle format
  --platform <type>           platform destination
  --bundle                    bundle dependencies
  --minify                    minify the build
  --public <path>             public path
  --target <query>            output targets (es5, es2015, es2020)
  --entryNames <pattern>      output file names
  --chunkNames <pattern>      output chunk names
  --assetNames <pattern>      output asset names
  --clean                     cleanup output path
  --manifest <path>           generate manifest file
  --entrypoints <path>        generate entrypoints file
  --name <identifier>         the iife global name
  --external [modules]        comma separated external packages
  --no-map                    do not generate sourcemaps
  --jsx <mode>                jsx transformation mode (transform, preserve, automatic)
  --jsxFactory <identifier>   jsx pragma
  --jsxFragment <identifier>  jsx fragment
  --jsxImportSource <name>    jsx module name
  -h, --help                  display help for command
```

**Samples**

```sh
$ rna build src/index.js --output dist/esm/index.js --format esm
$ rna build src/index.js --output public/index.js --format iife --minify --bundle
$ rna build src/index.css --output public/index.css --minify --bundle
```

### Known limitations and workarounds

Esbuild does not merge import statements from the same external source when bundling (see [#3](https://github.com/chialab/rna/issues/3)). Consumed esbuild bundles in webpack can be affected by a wrong optimization.

**Workaround**  
Update webpack configuration with following rule:

```js
module.exports = {
    optimization: {
        innerGraph: false,
    },
};
```

## License

**RNA Bundler** is released under the [MIT](https://github.com/chialab/rna/blob/main/packages/rna-bundler/LICENSE) license.

---
_Source: https://npm.io/package/@chialab/rna-bundler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
