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

hapi-universal-webpack-plugin

v0.2.0

Published

Hapi plugin that implements dev, hot and hot-server middleware for weback

Downloads

36

Readme

Hapi Universal Webpack Plugin

This plugin integrates webpack-dev-middleware, webpack-hot-middleware and webpack-hot-server-middleware into hapi in order to provide hot-reloading of universal apps (i.e. apps that run on the client and the server).

Prerequisites

The following two packages are a peer dependency for this plugin.

  • Hapi (tested on >= 17.0)
  • webpack (tested on >= 4.0)

Installation

$ npm i -D hapi-universal-webpack-plugin

Usage

The following steps are required for you to implement the plugin and make it work.

Hapi

Before you start the server, you want to register the plugin. Provided you have webpack configurations for client and server, the following snippet will get you up and running.

const HapiUniversalWebpackPlugin = require('hapi-universal-webpack-plugin');
const clientConfig = require('path/to/webpack/config');
const serverConfig = require('path/to/webpack/config');

server.register({
    plugin: HapiUniversalWebpackPlugin,
    options: {
        clientConfig,
        serverConfig,
    },
});

Options

The options object from the example above accepts the following values:

| Key | Type | Default | Required | Description | |----------------------------|--------|-----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | clientConfig | Object | undefined | yes | webpack configuration for processing the client-side code. | | serverConfig | Object | undefined | no | webpack configuration for processing the server-side code. Without this, the plugin will run in client-only mode, which is fine if you do not need server-side rendering. | | devMiddlewareOptions | Object | {} | no | Options that get passed down to webpack-dev-middleware. See their documentation for further information. | | hotMiddlewareOptions | Object | {} | no | Options that get passed down to webpack-hot-middleware. See their documentation for further information. | | hotServerMiddlewareOptions | Object | {} | no | Options that get passed down to webpack-hot-server-middleware. See their documentation for further information. |

Webpack

A more detailed documentation on how to setup your webpack configurations is coming very soon. In the meantime, just refer to the examples/ directory of this repository, to see the plugin in action using the example of a universally rendered VueJS application.

Acknowledgement

hapi-webpack-plugin is a great solution if you do not need the server-side rendering part this plugin provides. It also served as great inspiration for this implementation.

webpack-hot-server-middleware is the package that provides us with webpack-integration for server-side bundling.

License

MIT