npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

browser-reload-plugin

v1.1.0

Published

Automatically reload the browser page on every Webpack watch build

Downloads

48

Readme

browser-reload-plugin Latest version Monthly downloads Install size

Automatically reload the browser page on every Webpack watch build

🙋‍♂️ Why?

  • 🔥 Automatic browser reloads Speed up development by auto-reloading as soon as your build completes!
  • ⚡️ Quick setup All you need is two lines of code to add the plugin!
  • 🔌 Auto Reconnects Automatically reconnects when restarting the watch!

🚀 Install

npm i -D browser-reload-plugin

🚦 Quick Setup

In your development Webpack config:

+ const BrowserReloadPlugin = require('browser-reload-plugin')

  module.exports = {
    ...,

    plugins: [
+     new BrowserReloadPlugin()
    ]
  }

That's it! 🎉 Just run your watch command to see it in action.

🎛 Browser API

The plugin globally exposes a __browserReloadPlugin object that lets you configure the plugin at run-time.

  • enabled (true) - Whether to reload the browser on changes.
  • retryWait (retryWait from plugin options) - How long to wait before re-trying a failed connection on the client-side.
  • wsServer (ws://localhost:PORT) - The WebSocket server address.

To recongiure at run-time, simply rewrite the object properties:

__browserReloadPlugin.enabled = false;

⚙️ Options

  • port (8080) - Port to bind the servert to. If unavailable, it falls back to a random available port.
  • retryWait (5000) - How long to wait before re-trying a failed connection on the client-side.
  • include (/\.js$/) - A pattern (string | RegExp | [string, RegExp]) to match entry-files to add the client-code to. This is useful if your app has multiple entry-points but you only want the reload client to be added to specific ones.
  • exclude - A pattern (string | RegExp | [string, RegExp]) to exclude certain entry-points.

💁‍♀️ FAQ

Does this work on regular builds?

No, it's designed specifically for Webpack watch mode.

Should I use this over Hot Module Replacement (HMR)?

No, HMR is far superior to this approach. Only use this plugin when you have a sophisticated application that doesn't work well with HMR but you'd still like to automate browser page reloads on build.

How is this different from webpack-livereload-plugin?

webpack-livereload-plugin requires adding a <script> tag to your HTML document in order to make live-reload work. This plugin automatically injects itself to the entry-points of your app, and doesn't require any additional setup apart from adding the plugin to the Webpack configuration. It's also much lighter & faster.