# @rbnlffl/esbuild-plugin-browser-sync

> easily integrate browser-sync into your esbuild development flow 🌊

Latest version **0.0.1** (published 2023-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rbnlffl/esbuild-plugin-browser-sync
pnpm add @rbnlffl/esbuild-plugin-browser-sync
yarn add @rbnlffl/esbuild-plugin-browser-sync
bun add @rbnlffl/esbuild-plugin-browser-sync
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-03-25 |
| First published | 2023-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 2 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Robin Löffel |
| Maintainers | rbnlffl |
| Keywords | esbuild-plugin, browser-sync |

## Links

- npm: https://www.npmjs.com/package/@rbnlffl/esbuild-plugin-browser-sync
- Repository: https://github.com/robinloeffel/esbuild-plugin-browser-sync
- Issues: https://github.com/robinloeffel/esbuild-plugin-browser-sync/issues
- npm.io page: https://npm.io/package/@rbnlffl/esbuild-plugin-browser-sync

## Dependencies (2)

- [browser-sync](https://npm.io/package/browser-sync.md) ^2.29.1
- [@types/browser-sync](https://npm.io/package/@types/browser-sync.md) ^2.27.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2023-03-25

## README

# @rbnlffl/esbuild-plugin-browser-sync

[![latest version on npm](https://img.shields.io/npm/v/@rbnlffl/esbuild-plugin-browser-sync)](https://www.npmjs.com/package/@rbnlffl/esbuild-plugin-browser-sync)
[![npm downloads a month](https://img.shields.io/npm/dm/@rbnlffl/esbuild-plugin-browser-sync)](https://www.npmjs.com/package/@rbnlffl/esbuild-plugin-browser-sync)
[![browser-sync dep](https://img.shields.io/npm/dependency-version/@rbnlffl/esbuild-plugin-browser-sync/browser-sync)](https://github.com/BrowserSync/browser-sync)
[![required node version](https://img.shields.io/node/v/@rbnlffl/esbuild-plugin-browser-sync)](https://github.com/nodejs/Release)
[![package license](https://img.shields.io/npm/l/@rbnlffl/esbuild-plugin-browser-sync)](license)

> easily integrate [`browser-sync`](https://github.com/BrowserSync/browser-sync) into your [`esbuild`](https://github.com/esbuild/esbuild) development flow 🌊

## install

```bash
yarn install --dev @rbnlffl/esbuild-plugin-browser-sync
```

## use

```typescript
import esbuild from "esbuild";
import browserSync from "@rbnlffl/esbuild-plugin-browser-sync";

const context = await esbuild.context({
  /* esbuild config */
  plugins: [
    browserSync({ /* options */ })
  ]
});
context.watch();
```

## config

all of the supplied configuration options get directly forwarded to `browser-sync`. you can find the official docs here: https://browsersync.io/docs/options

## caveats

since `esbuild` doesn't expose to its plugins whether it's in watch mode or not, whenever you include this bad boy, it will spin up a brand new `browser-sync` session for you. even if you just once call `esbuild.build`. so be mindful of that.

furthermore, if you are in `esbuild`'s watch mode, and you've configured `browser-sync` to watch certain files, as well, make sure there are no overlaps in your [`files`](https://browsersync.io/docs/options#option-files) prop and the actual sources you're piping to `esbuild`. the plugin will automatically trigger a [`reload`](https://browsersync.io/docs/api#api-reload) every time one of the source files that `esbuild` knows of, change. this may otherwise lead to multiple reloads, and unnecessary work for your cpu.

the best way to use this plugin is to have `esbuild` take care of watching the source files, and instruct `browser-sync` to watch assets that are outside of what you process via esbuild, like html files, an svg sprite, images, and so on. this allows you to have a smooth and very performant dx for web pages.

## license

[mit](license)

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