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-scheme-helper

v1.1.1

Published

Minimizes the amount of configuration necessary for webpack build 'schemes'. Source is in TypeScript.

Readme

Webpack Scheme Helper

Minimize the amount of configuration and code necessary for webpack by using 'schemes'.
Otherwise known as 'scenarios'.

Source code is in TypeScript.

Schemes

Schemes are a typical way that files are deployed.
This utility simplifies the construction of a config that follows a typical scheme.

Certain settings are enabled by default:

  • JavaScript (and .jsx files)
  • Builds are cleaned by default.
  • All files are hashed.
  • All files are minified and source-mapped by default.
  • Proper long term hashing is retained using the hash plugin.
  • webpack-assets.json is generated by default.

Other file types are managed by including their loader as part of your package.json and enabling them in your scheme.

  • TypeScript (and .tsx files)
  • HTML, CSS, SaSS, and LeSS
  • Fonts and Images.

After which, all you have to do is provide the project path and build paths.

Example

The following example takes all the dependencies defined in the package.json along with any manually specified entries.
It will successfully compile and bundle all TypeScript, CSS, LeSS files (and SaSS if desired) into a web folder structure like so:

(An underscore prefix is used so as not to be confused with a route or to designate a category.)

wwwroot
|- /_client
  |- /vendor
    |- /_fonts
      ... (fonts from bootstrap)
    |- jquery
    |- bootstrap
    ... (and more modules)
  |- /local
    |- main
    (will include a common chunk if more entries specified)
vendor.ts
import WebpackScheme from 'webpack-scheme-helper';
import { PROJECT, WEB, BUILD, PACKAGE } from '../constants';

export default
WebpackScheme

	// Use the 'full' scheme as a starting point.
	// This enables all features by default.
	.full()

	// Define the build paths for this config.
	.builder({
		project: PROJECT.ROOT,
		web: WEB.ROOT, // wwwroot
		build: `${BUILD.PATH}/vendor` // _client/vendor
	})

	// Calling .full() will look for .scss files
	// But SaSS is not used in this project.
	// Ommiting this will have no effect if there are no .scss files in your project.
	.scss(false)

	// Compile all the modules individually.
	.addModules(Object.keys(PACKAGE.JSON.dependencies))

	// Expose jQuery to Bootstrap.
	.provide({
		"$":"jquery",
		"jQuery":"jquery"
	})

	// Define bootstrap's css as its own entry
	// so if by chance the next version only has JavaScript changes.
	// This also include fonts since .full() was used.
	.addEntry(
		"bootstrap.css",
		"./node_modules/bootstrap/dist/css/bootstrap.css")

	.render();
local.ts
import WebpackScheme from 'webpack-scheme-helper';
import { PROJECT, WEB, BUILD } from '../constants';

export default
WebpackScheme

	// Use the 'minimal' scheme as a starting point.
	// This starts with JavaScript enabled only.
	.minimal()

	// Define the build paths for this config.
	.builder({
		project: PROJECT.ROOT,
		web: WEB.ROOT, // wwwroot
		build: `${BUILD.PATH}/local` // _client/local
	})

	// Enable LeSS processing.
	.less()

	// Enable TypeScript.
	.typescript()

	// Reference the main.ts file as the local entry.
	.addEntry("main", "./Client/src/main.ts")

	.render();
config.ts

Combine the two configs together.

import vendor from "./vendor";
import local from "./local";

export default
[
	vendor,
	local
]
webpack.config.js

Demonstrates how to use TypeScript for configs instead of just JavaScript.

'use strict';
// Interpret TypeScript.
require('ts-node').register({ compilerOptions:{ target: "ES2016" } });
module.exports = require('./Webpack/config.ts');

Why?

Webpack configs are detailed and highly configurable, but settings must be configured in multiple places for one specific file type or option to work properly. This utility procedurally configures all necessary options based upon desired features and the source code for the procedure is easily readable.

A lot of time and care has gone into getting this utility to follow Webpack best practices. Comments and feedback are encouraged.

Installation

npm install webpack webpack-scheme-helper --save-dev

Currently, schemes work with your existing Webpack installation as a peer dependency. If you're only packing JavaScript, then no additional installation is necessary. But if you are planning to use features beyond just JavaScript you will need include the modules and loaders necessary.

The following are the modules necessary if you are going to use a specific loader.

TypeScript

npm install ts-loader --save-dev

Also recommended:

npm install ts-node --save-dev
npm install tslib --save

HTML

https://webpack.js.org/loaders/html-loader/

npm install html-loader --save-dev

CSS

https://webpack.js.org/loaders/css-loader/

npm install css-loader style-loader --save-dev

SaSS

https://webpack.js.org/loaders/sass-loader/

npm install node-sass style-loader less-loader --save-dev

LeSS

https://webpack.js.org/loaders/less-loader/

npm install less style-loader less-loader --save-dev

Fonts or Images

https://webpack.js.org/loaders/file-loader/

npm install file-loader --save-dev

Working Cross-Platform Sample

https://github.com/electricessence/aspnet-core2-starter