{"id":20255,"library":"p-webpack","title":"p-webpack","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/Richienb/p-webpack","tags":["javascript","webpack","promise","options","object","value"],"install":[{"cmd":"npm install p-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add p-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add p-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; p-webpack wraps webpack's compiler","package":"webpack","optional":false}],"imports":[{"note":"The module exports a single async function; CommonJS require works but TypeScript types may prefer ESM import.","wrong":"const webpack = require('p-webpack')","symbol":"default","correct":"import webpack from 'p-webpack'"},{"note":"This is a default-export module; destructuring the name does not work.","wrong":"const { webpack } = require('p-webpack')","symbol":"p-webpack","correct":"const webpack = require('p-webpack')"}],"quickstart":{"code":"const webpack = require('p-webpack');\nconst fs = require('fs');\n\nasync function build() {\n  try {\n    const stats = await webpack({\n      entry: './src/index.js',\n      output: {\n        path: __dirname + '/dist',\n        filename: 'bundle.js'\n      }\n    });\n    console.log('Build completed:', stats.toString({ colors: true }));\n  } catch (err) {\n    console.error('Build failed:', err);\n  }\n}\n\nbuild();","lang":"javascript","description":"Shows basic usage of p-webpack with async/await, using a simple webpack configuration."},"warnings":[{"fix":"Run 'npm install webpack' alongside p-webpack.","message":"Requires webpack as a peer dependency. Must install webpack separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use webpack's native promise support or upgrade to a newer wrapper.","message":"Only works with webpack 1-4. Does not support webpack 5's new compiler API.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use webpack's own multi-compiler or watch APIs directly for those features.","message":"Does not support multi-compiler or watch mode. Only wraps the single run() callback.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'-4':22 '1':21 '1.0.1':24 '4':96 'accept':31 'add':12 'altern':65 'api':19 'base':62 'callback':61 'callback-bas':60 'compat':85 'compil':18,46 'compiler.run':63 'configur':34 'current':27 'depend':54,103 'focus':76 'full':84 'javascript':104 'librari':55 'like':66 'maintain':83 'manual':71 'method':81 'minim':51 'no-depend':52 'node.js':95 'object':90,108 'option':35,89,107 'p':2,5,74 'p-webpack':1,4,73 'peer':102 'promis':13,41,69,106 'promisifi':58 'releas':29 'requir':98 'resolv':43 'return':39 'run':80 'simpli':57 'stabl':28 'stat':47 'suitabl':93 'support':14 'thin':9 'unlik':64 'valu':109 'version':20,23 'webpack':3,6,16,37,68,75,87,99,105 'webpack-promis':67 'wrap':72 'wrapper':10","created_at":"2026-04-25T11:22:09.360436+00:00","updated_at":"2026-04-25T11:22:09.360436+00:00","problems":[{"fix":"Change 'const { webpack } = require(\"p-webpack\")' to 'const webpack = require(\"p-webpack\")'.","cause":"Incorrect import: destructured named export instead of default.","error":"TypeError: webpack is not a function"},{"fix":"Run 'npm install webpack' in your project.","cause":"Missing webpack peer dependency.","error":"Error: Cannot find module 'webpack'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Richienb/p-webpack","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/p-webpack","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}