@saboya/hapi-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Build Status Maintenance Status Dependency Status NPM version

@saboya/hapi-webpack-plugin

Webpack middleware for Hapi. Supports HMR.

This is a fork of Simon Degraeve's hapi-webpack-plugin. This is mostly a rewrite of the plugin using TypeScript and updating it for current versions of Webpack / Hapi, with some added features.

Webpack Version

This was tested with Webpack 4.41. Actual compatibility is unknown.

Hapi version

Tested with Hapi 19. Should be compatible with Hapi >= 17.

Installation

yarn add  @saboya/hapi-webpack-plugin

Usage

See webpack-dev-middleware and webpack-hot-middleware for all available options.

Options for webpack-dev-middleware are set with the dev key in the options object.

Options for webpack-hot-middleware are set with the hot key in the options object.

1) With object as options

import { Server } from '@hapi/hapi';
import { Plugin as HapiWebpackPlugin } from '@saboya/hapi-webpack-plugin';


/**
 * Create server
 */
const server = new Server();

/**
 * Register plugin and start server
 */
async function start() {
  await server.register({
    plugin: HapiWebpackPlugin,
    options: {
      dev: {
        publicPath: '/',
      }, // options for webpack-dev-middleware
      hot: {
        overlay: false,
      }, // options for webpack-hotmiddleware
      webpackConfig: {
        entry: 'src.js'
      },
    },
  })
  
  await server.start();
}

start()

2) With path as options

import { Server } from '@hapi/hapi';
import { Plugin as HapiWebpackPlugin } from '@saboya/hapi-webpack-plugin';


/**
 * Create server
 */
const server = new Server();

/**
 * Register plugin and start server
 */
async function start() {
  await server.register({
    plugin: HapiWebpackPlugin,
    options: {
      webpackConfig: './webpack.config.js'
    }
  })
  
  await server.start();
}

start()

Licence

The MIT License (MIT)

Copyright (c) 2015 Simon Degraeve

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i @saboya/hapi-webpack-plugin

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

15.6 kB

Total Files

20

Last publish

Collaborators

  • saboya