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

auto-live-reload-webpack-plugin

v1.0.4

Published

Webpack plugin that allows pages and resources to be automatically reloaded without using DevServer

Downloads

31

Readme

Auto Live Reload Webpack Plugin

npm License: MIT Build

This Webpack plugin can be used to reload the web page automatically when Webpack recompiled any bundle like HTML pages, JavaScript, or stylesheets. It works even on any custom server. DevServer is not required. The plugin is especially helpful when running Webpack in watch mode.

Install

npm i --save-dev auto-live-reload-webpack-plugin
yarn add --dev auto-live-reload-webpack-plugin

Options

| Option | Values | Default | |-----------|-----------------------------------|-------------| | host | host name or IP address as string | localhost | | port | any number between 0 - 65,535 | 0 | | enabled | true or false | true |

Host

The host can be any legal host name or IP address. If you run your server and client on the same machine, you can keep the default value localhost.

Port

The port can be any legal port number between 0 - 65,535. If set 0 as port, a random available port will be used.

Enabled

By default, live reloading is enabled. If enabled is explicitly set to false, the plugin creates live reload files with a no-op. This means that the live reload files are present, but will not trigger any reloads. This can be helpful if you don't need live reloads, but your server requires that the files are present and contain valid JavaScript.

Getting Started

  1. Install the plugin:
npm i --save-dev auto-live-reload-webpack-plugin
yarn add --dev auto-live-reload-webpack-plugin
  1. Add the plugin to your entry point in webpack.config.js or webpack.config.ts:
const path = require('path');
const AutoLiveReloadPlugin = require('auto-live-reload-webpack-plugin');

const autoAutoLiveReloadPlugin = new AutoLiveReloadPlugin({ /* place your options here */ });

module.exports = {
  entry: './src/index.js',
  plugins: [autoAutoLiveReloadPlugin],
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
};
  1. Add an entry point for the live reload bundles, which can be served by your custom server:
const path = require('path');
const AutoLiveReloadPlugin = require('auto-live-reload-webpack-plugin');

const autoAutoLiveReloadPlugin = new AutoLiveReloadPlugin();

module.exports = [
  {
    entry: './src/index.js',
    plugins: [autoAutoLiveReloadPlugin],
    output: {
      filename: 'main.js',
      path: path.resolve(__dirname, 'dist'),
    },
  },
  {
    entry: autoAutoLiveReloadPlugin.clientEntryFile(),
    output: {
      filename: 'main-livereload.js',
      path: path.resolve(__dirname, 'dist'),
    },
  }
];
  1. Add both main.js and main-livereload.js to your server. Both bundles have to be inserted into your HTML page. main.js contains all your business logic and main-livereload.js contains only a few lines for the live reload logic.

Multiple entry points can share the same instance of AutoLiveReloadPlugin and the same entry point for autoAutoLiveReloadPlugin.clientEntryFile(). However, multiple live reload files are supported in the same HTML page in opposite to tiny-lr based Webpack plugins.

Credits

Inspired by the awesome zsimo/handmade-livereload-webpack-plugin, enhanced and redeveloped in Typescript by Martin Winandy.