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 🙏

© 2026 – Pkg Stats / Ryan Hefner

webpack-dev-plugin-ng

v0.1.7

Published

Webpack dev plugin ng

Readme

webpack-dev-plugin-ng

Webpack dev plugin with hot-reloading for hapi.

Example dev server deps:

npm install --save-dev hapi vision inert handlebars webpack webpack-dev-plugin-ng find-root copy-webpack-plugin empty webpack-stats-plugin source-map json-loader babel-loader node-config-loader style-loader stack-source-map boom

Example dev server:

import path from 'path'

import {Server} from 'hapi'

import Vision from 'vision'
import Inert from 'inert'
import handlebars from 'handlebars'
import Boom from 'boom'

import {createHapiWebpackPlugin, createDevView} from 'webpack-dev-plugin-ng/hapi'
import webpack from 'webpack'

import config from './webpack.config'

const server = new Server()

const templatePath = path.resolve(__dirname, 'index.html')
const staticPagesMask = new RegExp('^/(index|confirm|wait)?(\.html)?$', 'g')

server.register(
  [
    Vision,
    Inert,
    createHapiWebpackPlugin({
      config,
      webpack,
      hot: true,
      devView: createDevView({staticPagesMask, templatePath})
    })
  ], (err?: Error) => {
    server.views({
      allowAbsolutePaths: true,
      compileOptions: {
          noEscape: true
      },
      engines: {
          html: handlebars
      }
    })
  }
)

Example html template:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8"/>
    <title>dev app</title>
  </head>
  <body>
    <div id="app"></div>
    <script>
      window.PostData = {{payload}}
    </script>
    <script src="/app.js"></script>
  </body>
</html>

Example webpack.config:


import path from 'path'
import fr from 'find-root'

import {
    DefinePlugin,
    NormalModuleReplacementPlugin,
    optimize
} from 'webpack'
import CopyPlugin from 'copy-webpack-plugin'
import {StatsWriterPlugin} from 'webpack-stats-plugin'

const debugStubPath: string = require.resolve('empty/functionThatReturns')
const root = fr(__dirname)
const {version, name} = require(path.resolve(root, 'package.json'))

const isProduction: boolean = process.env.NODE_ENV === 'production'

const styleOptions: string [] = [
    'singleton'
]

const cssOptions: string[] = [
    'autoprefixer',
    (isProduction ? '-' : '') + 'sourceMap',
    (isProduction ? '' : '-') + 'minimize'
]

const fallback = []
if (process.env.NVM_PATH) {
    fallback.push(path.resolve(process.env.NVM_PATH, '..', 'node_modules'))
}
fallback.push(path.resolve(root, 'node_modules'))

function createStyleLoaders(...args: any[]): string[] {
    const styleLoader = 'style?' + styleOptions.join('&')
    const cssLoader = 'css?' + cssOptions.join('&')
    return [styleLoader, cssLoader].concat(args)
}

const main: string = 'app.js'

const commonEntries = isProduction
    ? []
    : [
        'stack-source-map/register'
    ]

export default {
    cwd: root,
    cache: !isProduction,
    debug: !isProduction,
    devtool: isProduction ? '' : 'source-map',
    resolve: {
        fallback
    },
    resolveLoader: {
        fallback
    },
    output: {
        publicPath: '/',
        path: path.resolve(root, 'dist'),
        filename: main
    },
    entry: {
        'browser': commonEntries.concat([
            path.resolve(root, 'src', 'browser.js')
        ])
    },
    configLoader: {
        env: process.env.NODE_ENV === 'production' ? 'prod' : 'dev',
        instance: process.env.PROFILE || 'client'
    },
    module: {
        preLoaders: [
            {
                test: /\.js$/,
                exclude: ['src', 'lib'],
                loaders: ['source-map']
            }
        ],
        loaders: [
            {
                test: /.*\.configloaderrc$/,
                loader: 'node-config-loader/webpack'
            },
            {
                test: /\.json$/,
                loaders: ['json-loader']
            },
            {
                test: /\.(?:jsx?|es6)$/,
                include: /(?:src)/,
                exclude: /(?:node_modules|bower_components)/,
                loaders: ['babel-loader'] // 'react-hot-loader'
            },
            {
                test: /\.(?:png|jpg|gif|ico)$/,
                loader: 'file?name=assets/[name].[ext]'
            },
            {
                test: /\.(?:eot|woff|woff2|ttf|svg)(?:\?v\=[\d\w\.]+)?$/,
                loader: 'file?name=assets/[name].[ext]'
            },
            {
                test: /\.styl$/,
                include: /(?:assets)/,
                loaders: createStyleLoaders('stylus')
            },
            {
                test: /\.css$/,
                include: /(?:assets)/,
                loaders: createStyleLoaders()
            }
        ]
    },
    plugins: [
        new StatsWriterPlugin({
            filename: 'build.json',
            transform: (meta, opts) => JSON.stringify({name, version, main, ...meta}, null, '  '),
            fields: ['hash', 'errors', 'warnings', 'assets']
        }),
        new DefinePlugin({
            'process.env': {
                __VERSION__: JSON.stringify(version),
                IS_BROWSER: true,
                NODE_ENV: JSON.stringify(process.env.NODE_ENV)
            }
        }),
        new CopyPlugin([
            {
                from: path.join(root, 'assets', '*'),
                to: 'assets'
            }
        ])
    ]
    .concat(isProduction
        ? [
            new optimize.DedupePlugin(),
            new optimize.OccurenceOrderPlugin(),
            new optimize.UglifyJsPlugin({
                compress: {
                    warnings: false
                }
            }),
            new NormalModuleReplacementPlugin(/^debug$/, debugStubPath)
        ]
        : [
        ]
    )
}