{"id":27859,"library":"hapi-webpack-plugin","title":"hapi-webpack-plugin","description":"Webpack middleware plugin for Hapi.js that integrates webpack-dev-middleware and webpack-hot-middleware to enable Hot Module Replacement (HMR) during development. Version 3.0.0 supports Hapi >= 17.x and webpack >= 2.x. It offers two usage modes: passing an object with compiler/assets/hot options, or a path to a webpack config file. Compared to alternatives like hapi-webpack-dev-middleware, this plugin bundles both middlewares and supports HMR out of the box. Release cadence is sporadic; last release was in 2018, and it is considered stable but unmaintained.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/SimonDegraeve/hapi-webpack-plugin","tags":["javascript","hapi","webpack","live-reload","dev-server"],"install":[{"cmd":"npm install hapi-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add hapi-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add hapi-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core middleware for serving webpack assets","package":"webpack-dev-middleware","optional":false},{"reason":"Middleware for Hot Module Replacement","package":"webpack-hot-middleware","optional":true}],"imports":[{"note":"ESM default export; CJS require works but is not recommended for newer versions.","wrong":"const WebpackPlugin = require('hapi-webpack-plugin')","symbol":"WebpackPlugin","correct":"import WebpackPlugin from 'hapi-webpack-plugin'"},{"note":"Hapi v17+ uses @hapi/hapi; older hapi package is deprecated.","wrong":"const Server = require('hapi').Server","symbol":"Server (hapi)","correct":"import {Server} from '@hapi/hapi' or 'hapi'"},{"note":"ESM import works; webpack also has named exports but this plugin uses default.","wrong":"const webpack = require('webpack')","symbol":"Webpack","correct":"import Webpack from 'webpack'"}],"quickstart":{"code":"import {Server} from '@hapi/hapi';\nimport Webpack from 'webpack';\nimport WebpackPlugin from 'hapi-webpack-plugin';\n\nconst server = new Server({port: 3000});\nconst compiler = Webpack({\n  entry: './src/index.js',\n  output: {path: __dirname + '/dist', filename: 'bundle.js'},\n  mode: 'development'\n});\n\nasync function start() {\n  await server.register({\n    plugin: WebpackPlugin,\n    options: {\n      compiler,\n      assets: {publicPath: '/'},\n      hot: true\n    }\n  });\n  await server.start();\n  console.log('Server running at:', server.info.uri);\n}\nstart().catch(console.error);","lang":"javascript","description":"Registers the hapi-webpack-plugin with Hapi v17+, passing a webpack compiler and enabling HMR."},"warnings":[{"fix":"Use version 2.x.x for Hapi <= 16.x.","message":"Version 3.0.0 only works with Hapi >= 17.x; does not support Hapi 16.x or older.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Install @hapi/hapi instead of hapi.","message":"The 'hapi' package is deprecated; use '@hapi/hapi' for Hapi v17+.","severity":"deprecated","affected_versions":">=17"},{"fix":"Ensure options object includes 'compiler', 'assets', and 'hot' correctly.","message":"The plugin expects 'compiler' property in options; misspelling or missing will cause silent failure.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Export an object from webpack.config.js.","message":"When using path option, the webpack config file must export a valid configuration object, not a function.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Upgrade to Hapi v17+ and use async registration.","message":"Hapi v16 callback style registration is deprecated; use async/await with Hapi v17.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"npm install webpack-dev-middleware --save-dev","cause":"Missing webpack-dev-middleware dependency.","error":"Error: Cannot find module 'webpack-dev-middleware'"},{"fix":"Call Webpack(config) to create compiler, then pass it.","cause":"Webpack compiler not initialized correctly.","error":"TypeError: compiler is not a function"},{"fix":"Pass {compiler, assets, hot} in options.","cause":"Options missing 'compiler' property or it's not a valid compiler.","error":"AssertionError: options.compiler must be a webpack compiler instance"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}