New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rbnlffl/esbuild-plugin-browser-sync

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rbnlffl/esbuild-plugin-browser-sync

easily integrate browser-sync into your esbuild development flow 🌊

0.0.1
latest
Source
npm
Version published
Weekly downloads
17
21.43%
Maintainers
1
Weekly downloads
 
Created
Source

@rbnlffl/esbuild-plugin-browser-sync

latest version on npm npm downloads a month browser-sync dep required node version package license

easily integrate browser-sync into your esbuild development flow 🌊

install

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

use

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 prop and the actual sources you're piping to esbuild. the plugin will automatically trigger a 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

Keywords

esbuild-plugin

FAQs

Package last updated on 25 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts