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

webpack-blocks-happypack

v0.2.0

Published

A webpack block that adds happypack support to your webpack config.

Downloads

267

Readme

webpack-blocks-happypack

Generated with nod NPM version Build Status Coverage Status

A webpack block that adds happypack support to your webpack config.

This package is based on the PR by @fenos on the official webpack-blocks repository.

Install

$ npm install --save-dev webpack-blocks-happypack

Usage

Basic

const { createConfig } = require('@webpack-blocks/webpack2')
const babel = require('@webpack-blocks/babel6')
const cssModules = require('@webpack-blocks/css-modules')
const extractText = require('@webpack-blocks/extract-text2')
const happypack = require('webpack-blocks-happypack')

const config = createConfig([
  cssModules(),
  happypack([
    // these will be happypack'd
    extractText(),
    babel(),
  ]),
])

Configuration

const config = createConfig([
  happypack([
    babel(),
  ], {
    // default options
    loaders: ['babel-loader', 'css-loader'], // allowed loaders
    cache: !process.env.DISABLE_HAPPY_CACHE,
    cacheContext: {
      env: process.env.NODE_ENV,
      refresh: process.env.REFRESH_HAPPY_CACHE ? Math.random() : 0,
      // ... add or override happypack cacheContext options
    },
    // ... add or override happypack options
  }),
])

Environment variables

$ DISABLE_HAPPY=true webpack # turns happypack off and run webpack
$ DISABLE_HAPPY_CACHE=true webpack # turns happypack cache off and run webpack
$ REFRESH_HAPPY_CACHE=true webpack # refreshes happypack cache and run webpack

How it does

This webpack block adds HappyPack plugins with proper IDs and replaces loaders by happypack/loader?id=${id}.

API

happypack

Parameters

  • blocks Array<WebpackBlock>
  • $1 any (optional, default {})
    • $1.loaders (optional, default ['babel-loader','css-loader'])
    • $1.happypackOptions ...any

Returns Array<Block>

Loader

Type: string

Rule

Type: {test: RegExp, loader: (Loader | Array<Loader>)?, loaders: (Loader | Array<Loader>)?, use: (Loader | Array<Loader>)?, options: Object?}

Properties

Block

Type: {plugins: Array<any>?, module: {loaders: Array<Rule>?, rules: Array<Rule>?}}

Properties

BlockOptions

Type: {loaders: Array<string>?, refresh: boolean?, cache: any?, cacheContext: {}?}

Properties

WebpackBlock

Type: function (context: any, utils: any): function (prevCongig: any): Block

Other useful webpack blocks

License

MIT © Diego Haz