webpack-partial
raw JSON → 2.2.0 verified Sat Apr 25 auth: no javascript
A utility library for composing webpack configuration files using composable helper functions. Version 2.2.0 is the latest stable release (npm). The package provides curried helpers (entry, loader, output, plugin, tap) that take configuration arguments and a webpack config object, enabling clean composition via lodash/fp/compose. It normalizes entry values to arrays for consistency and supports functional patterns. Unlike ad-hoc merging or webpack-merge, it offers a functional, composable API targeted at modular webpack configs. No explicit release cadence.
Common errors
error TypeError: (0 , _entry.default) is not a function ↓
cause Using non-default import or wrong import path (e.g., import { entry } from 'webpack-partial')
fix
Use default import: import entry from 'webpack-partial/entry'
error Error: entry.map is not a function ↓
cause Entry helper expects an array value but received an object or string directly.
fix
Wrap value in array or use the function callback form.
Warnings
gotcha Entry values are always normalized to arrays. Mixing with plain string/webpack array expectations may cause confusion. ↓
fix Use array operations when accessing entry values inside callbacks.
gotcha Functions are curried and expect the webpack config as the last argument. Forgetting to apply all arguments results in a partial function instead of a config. ↓
fix Ensure you provide all arguments or use compose to pass the config at the end.
deprecated The package does not follow semantic versioning strictly; minor releases may include breaking changes. ↓
fix Pin to exact version and review changelog before upgrading.
Install
npm install webpack-partial yarn add webpack-partial pnpm add webpack-partial Imports
- entry
import entry from 'webpack-partial/entry' - loader
import loader from 'webpack-partial/loader' - output
import output from 'webpack-partial/output' - plugin
import plugin from 'webpack-partial/plugin' - tap
import tap from 'webpack-partial/tap'
Quickstart
import compose from 'lodash/fp/compose';
import entry from 'webpack-partial/entry';
import loader from 'webpack-partial/loader';
import plugin from 'webpack-partial/plugin';
import output from 'webpack-partial/output';
import tap from 'webpack-partial/tap';
import StatsPlugin from 'stats-webpack-plugin';
const config = compose(
entry('src/index.js'),
loader({ test: /\.js$/, use: 'babel-loader' }),
plugin(new StatsPlugin()),
output({ publicPath: '/build/' }),
tap(config => console.log('Final config:', config))
)({ mode: 'development' });
export default config;