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 🙏

© 2025 – Pkg Stats / Ryan Hefner

webpack.config.manager

v0.0.7

Published

## Usage

Downloads

13

Readme

Webpack configuration manager

Usage

To use webpack.config.manager you should relay on the directory named 'webpack.config' in the root of you appliction. webpack.config.manager use the environment variables —— WEBPACK_ENV to merge the specific configuration to generate the final configuration.

For example:

Presumably set WEBPACK_ENV=production, then webpack.config.manager will use the webpack.config.js and webpack.config.production.js under the 'webpack.config' directory to generate the final configuration.

Here are some advanced examples:

Use the config interface

const webpackConfigManager= require('webpack.config.manager');

//合并`webpack.config/webpack.config.js`和`webpack.config/webpack.config.production.js`
let productionConf = webpackConfigManager.config('production');

Get the inner configuration path

const execSync = require('child_process').execSync;
const webpackConfigManager= require('webpack.config.manager');

let configPath = webpackConfigManager.configPath;

execSync(`WEBPACK_ENV=dev webpack-dev-server --config ${configPath}`)

Use as npm_scripts

// package.json
{
  ...
  "scripts": {
    "build": "WEBPACK_ENV=production webpack --config webpack.config.js"
  },
  ...
}

// webpack.config.js
module.exports = require('webpack.config.manager').config;

Why webpack.config.manager

When it comes to develop a much more advanced app with webpack, one may use one configuration for development and another for publish only. So we can add webpack.config.js for development and webpack.config.production.js for publish,but the problem is this two files may be just similar to each other, expect that you may add some additional plugins to optimize the online version, for example use JSUglify plugin for production.

How about we just require webpack.config.js and then add some other code in webpack.config.production.js, like:

require('webpack.config.js').plugins.push(somePlugins);

That seems work, even through not graceful. But what if we do not what something in development, for example if we don't want output.pathInfo and so on, and even under more complex situation, we need to provide multiple development scenarios, one for local ajax mock and one for real remote ajax request. To meet all these particular demands, more and more ugly code will be added to you configuration files, finally you may find youself in mess.

Now with webpack.config.manager, things will be much easyier. For it can auto merge configuration for different purposes. With a base configuration webpack.config.js, if you want to develop locally, then set WEBPCAK_ENV=local, the output configuration is the merged result of webpack.config.js and webpack.config.local.js, and so forth.

Check out the example to find more details.