Registry / devops / webpack-config-utils

webpack-config-utils

JSON →
library2.3.1jsnpmunverified

Utilities to make webpack configuration objects easier to compose and read. Current stable version is 2.3.1. The package provides helper functions like getIfUtils, removeEmpty, and props to conditionally include parts of the config based on environment. It differentiates from plain webpack config by reducing conditional logic and removing empty entries. Last release was in 2016; no further development. Works with webpack 1, 2, and 3.

npm install webpack-config-utils
INSTALL
IMPORT
SIG · WEBPACK-CONFIG-UTI
W
webpack-config-utils
devopsjavascriptv2.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getIfUtils
const { getIfUtils } = require('webpack-config-utils')
import { getIfUtils } from 'webpack-config-utils'
CommonJS only; does not support ESM imports.
removeEmpty
const { removeEmpty } = require('webpack-config-utils')
const removeEmpty = require('webpack-config-utils').removeEmpty
Both work, but destructuring is idiomatic.
props
const { props } = require('webpack-config-utils')
const props = require('webpack-config-utils/props')
Props is exported as a named export from the main entry.

Shows how to use getIfUtils and removeEmpty to conditionally configure a webpack config based on NODE_ENV.

const { getIfUtils, removeEmpty } = require('webpack-config-utils'); const webpack = require('webpack'); const { ifProduction, ifNotProduction } = getIfUtils(process.env.NODE_ENV); module.exports = { mode: ifProduction('production', 'development'), entry: removeEmpty({ app: ifProduction('./indexWithoutCSS', './indexWithCSS'), css: ifProduction('./style.scss') }), output: { chunkFilename: ifProduction('js/[id].[contenthash].js', 'js/[name].js'), filename: ifProduction('js/[id].[contenthash].js', 'js/[name].js'), }, plugins: removeEmpty([ ifProduction(new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } })) ]) };
Debug
Known issues
breakingv2.0.0 removed the 'here' export.
fix
Do not use 'here' from this package; use path.resolve instead.
affects: >=2.0.0
deprecatedThe package is no longer maintained; last release in 2016.
fix
Consider alternatives like webpack-merge or webpack-chain for more comprehensive config management.
affects: *
gotchagetIfUtils expects a string or object with keys, not an env from --env; with webpack 2+, pass env directly.
fix
Use getIfUtils(env) where env is the object from CLI --env flags.
affects: *
gotcharemoveEmpty only removes undefined and null, not empty strings or arrays.
fix
Manually filter or use a different helper if you need to remove empty strings.
affects: *
Errors
Common errors & fixes
TypeError: getIfUtils is not a function
Importing incorrectly or destructuring from wrong source.
fix
Use const { getIfUtils } = require('webpack-config-utils');
Cannot find module 'webpack-config-utils'
Package not installed.
fix
Run npm install --save-dev webpack-config-utils
Unhandled rejection: TypeError: Cannot read property 'production' of undefined
Passing undefined or wrong argument to getIfUtils.
fix
Ensure process.env.NODE_ENV is set or pass a valid string.
Upgrade
Version history
2.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
webpack-config-utils — npm install webpack-config-utils · libregistry