Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-universal-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-universal-webpack-plugin

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

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-12.5%
Maintainers
1
Weekly downloads
 
Created
Source

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:

KeyTypeDefaultRequiredDescription
clientConfigObjectundefinedyeswebpack configuration for processing the client-side code.
serverConfigObjectundefinednowebpack 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.
devMiddlewareOptionsObject{}noOptions that get passed down to webpack-dev-middleware. See their documentation for further information.
hotMiddlewareOptionsObject{}noOptions that get passed down to webpack-hot-middleware. See their documentation for further information.
hotServerMiddlewareOptionsObject{}noOptions 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

Keywords

FAQs

Package last updated on 15 Mar 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc