# browser-bundler

> Bundle React and TypeScript online without Node.js

Latest version **0.1.17** (published 2025-03-04) · 0 weekly downloads

## Install

```sh
npm install browser-bundler
pnpm add browser-bundler
yarn add browser-bundler
bun add browser-bundler
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.17 |
| Published | 2025-03-04 |
| First published | 2023-05-24 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Maintainers | steelydylan |

## Links

- npm: https://www.npmjs.com/package/browser-bundler
- Repository: https://github.com/steelydylan/browser-bundler
- Issues: https://github.com/steelydylan/browser-bundler/issues
- npm.io page: https://npm.io/package/browser-bundler

## Dependencies (1)

- [esbuild-wasm](https://npm.io/package/esbuild-wasm.md) 0.19.12

## Recent versions

- 0.1.17 (latest) — 2025-03-04
- 0.1.16 — 2025-03-03
- 0.1.15 — 2024-03-08
- 0.1.14 — 2024-03-08
- 0.1.13 — 2024-02-16
- 0.1.12 — 2024-01-05
- 0.1.11 — 2023-12-16
- 0.1.10 — 2023-12-16
- 0.1.9 — 2023-12-16
- 0.1.8 — 2023-12-16
- 0.1.7 — 2023-12-15
- 0.1.6 — 2023-12-15
- 0.1.5 — 2023-12-15
- 0.1.4 — 2023-12-15
- 0.1.3 — 2023-12-15
- … 12 more at https://npm.io/package/browser-bundler/versions

## README

# BrowserBundler

Bundle React and TypeScript online without Node.js

## Playground

https://mosya.dev/tools/react-ts

## Screenshots

![](./screenshot.png)

## Install

```
npm install browser-bundler
```

## Example

```js
import { browserBundle } from "browser-bundler";

const textarea = document.querySelector("#textarea") as HTMLTextAreaElement
const iframe = document.querySelector("#result") as HTMLIFrameElement

if (textarea && iframe) {
  textarea.value = `import React from "react";
import ReactDOM from "react-dom";

const App = () {
  return (<div>Hello World</div>
}

ReactDOM.render(<App />, document.getElementById("root"));`;

textarea.addEventListener("input", async () => {
  const code = textarea.value
  const { code: bundleCode } = await browserBundle(code)
  iframe.srcdoc = `
    <html>
      <head>
        <meta charset="utf-8">
      </head>
      <body>
        <div id="root"></div>
        <script type="module">
        ${bundleCode}
        </script>
      </body>
    </html>
  `
})
textarea.dispatchEvent(new Event("input"))
```


## Relative Path

```js
import { browserBundle } from "browser-bundler";

const code = `
import React from "react";
import ReactDOM from "react-dom";
import { Hello } from "./hello.tsx";

const App = () => {
  return (<div><Hello /></div>)
}

ReactDOM.render(<App />, document.getElementById("root"));
`

const result = await browserBundle(code, {
  files: {
    "./hello.tsx": `import React from "react";
    export const Hello = () => {
      return (<div>Hello World</div>)
    }`,
  }
})
```

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