Registry / devops / p-webpack

p-webpack

JSON →
library1.0.1jsnpmunverified

p-webpack is a thin wrapper that adds Promise support to Webpack's compile API (versions 1-4). Version 1.0.1 is the current stable release. It accepts the same configuration options as Webpack and returns a Promise that resolves with the compilation stats. It is a minimal, no-dependency library that simply promisifies the callback-based compiler.run(). Unlike alternatives like webpack-promise or manual wrapping, p-webpack focuses only on the run method and maintains full compatibility with Webpack's options object. It is suitable for Node.js 4+ and requires Webpack as a peer dependency.

npm install p-webpack
INSTALL
IMPORT
SIG · P-WEBPACK
P
p-webpack
devopsjavascriptv1.0.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.

default
import webpack from 'p-webpack'
const webpack = require('p-webpack')
The module exports a single async function; CommonJS require works but TypeScript types may prefer ESM import.
p-webpack
const webpack = require('p-webpack')
const { webpack } = require('p-webpack')
This is a default-export module; destructuring the name does not work.

Shows basic usage of p-webpack with async/await, using a simple webpack configuration.

const webpack = require('p-webpack'); const fs = require('fs'); async function build() { try { const stats = await webpack({ entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' } }); console.log('Build completed:', stats.toString({ colors: true })); } catch (err) { console.error('Build failed:', err); } } build();
Debug
Known issues
gotchaRequires webpack as a peer dependency. Must install webpack separately.
fix
Run 'npm install webpack' alongside p-webpack.
affects: >=1.0.0
gotchaOnly works with webpack 1-4. Does not support webpack 5's new compiler API.
fix
Use webpack's native promise support or upgrade to a newer wrapper.
affects: >=1.0.0
gotchaDoes not support multi-compiler or watch mode. Only wraps the single run() callback.
fix
Use webpack's own multi-compiler or watch APIs directly for those features.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: webpack is not a function
Incorrect import: destructured named export instead of default.
fix
Change 'const { webpack } = require("p-webpack")' to 'const webpack = require("p-webpack")'.
Error: Cannot find module 'webpack'
Missing webpack peer dependency.
fix
Run 'npm install webpack' in your project.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
webpackrequiredpeer dependency; p-webpack wraps webpack's compiler
Agent activity
2 hits · last 30 days
node
2
Resources
p-webpack — npm install p-webpack · libregistry