Registry / serialization / html-webpack-pug-plugin

html-webpack-pug-plugin

JSON →
library4.0.0jsnpmunverified

A webpack plugin that extends html-webpack-plugin to output Pug/Jade files instead of HTML. Version 4.0.0 supports webpack 3/4/5 and html-webpack-plugin 4/5. It processes the HTML generated by html-webpack-plugin and converts it to Pug, including script and link tags for webpack bundles. Key differentiators: it focuses solely on Pug output, not Slim or Haml (dropped in v0.1.0), and offers an optional AST mode (though discouraged due to vulnerable dependencies). Release cadence: stable, with infrequent updates.

npm install html-webpack-pug-plugin
INSTALL
IMPORT
SIG · HTML-WEBPACK-PUG-P
H
html-webpack-pug-plugin
serializationjavascriptv4.0.0
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.

HtmlWebpackPugPlugin
import HtmlWebpackPugPlugin from 'html-webpack-pug-plugin';
const { HtmlWebpackPugPlugin } = require('html-webpack-pug-plugin');
Default export, not named. Use import default or require with default property.
HtmlWebpackPugPlugin (CommonJS)
const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin');
const { HtmlWebpackPugPlugin } = require('html-webpack-pug-plugin');
CommonJS require returns the constructor directly, not an object.
HtmlWebpackPlugin
import HtmlWebpackPlugin from 'html-webpack-plugin';
import HtmlWebpackPugPlugin from 'html-webpack-plugin';
GitHub README example uses ES modules; 'html-webpack-pug-plugin' must be added separately.

Basic webpack config using html-webpack-pug-plugin with a Pug template, generating a Pug output file.

// webpack.config.js const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin'); module.exports = { entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' }, plugins: [ new HtmlWebpackPlugin({ template: 'src/template.pug', filename: 'index.pug', minify: false }), new HtmlWebpackPugPlugin({ adjustIndent: false }) ] };
Debug
Known issues
gotchaDo not use the plugin with Slim or Haml templates; support dropped in v0.1.0.
fix
Use html-webpack-slim-plugin or html-webpack-haml-plugin instead.
affects: >=0.1.0
deprecatedAST mode (option { ast: true }) uses outdated, vulnerable packages like pug-source-gen.
fix
Avoid setting ast: true; use default mode. If needed, pin vulnerable packages manually.
affects: >=0.1.0 <5.0.0
gotchaHtmlWebpackPugPlugin must be added exactly once, even with multiple HtmlWebpackPlugin instances.
fix
Instantiate HtmlWebpackPugPlugin only once in the plugins array.
affects: >=0.1.0
gotchaMinify must be set to false on HtmlWebpackPlugin to preserve valid Pug output.
fix
Add minify: false to HtmlWebpackPlugin options.
affects: >=0.1.0
breakingRenamed from 'html-webpack-jade-plugin' in early versions; all exports changed.
fix
Use HtmlWebpackPugPlugin (not HtmlWebpackJadePlugin).
affects: <0.1.0
Errors
Common errors & fixes
Error: Plugin could not be instantiated: HtmlWebpackPugPlugin is not a constructor
Using destructured require on a default-exported module (e.g., const { HtmlWebpackPugPlugin } = require('...'))
fix
Use const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin');
TypeError: Cannot read property 'options' of undefined
HtmlWebpackPugPlugin called before HtmlWebpackPlugin, or missing HtmlWebpackPlugin entirely
fix
Ensure HtmlWebpackPlugin is added first in plugins array and is instantiated.
Error: HtmlWebpackPugPlugin: adjustIndent is not a function
Passing adjustIndent option incorrectly (e.g., as a function instead of boolean)
fix
Set adjustIndent: true or false, not a function.
ModuleNotFoundError: Module not found: Error: Can't resolve 'pug'
Missing pug dependency if template uses pug but not installed
fix
Install pug: npm install --save-dev pug
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
html-webpack-pluginrequiredpeer dependency: provides the HTML generation that this plugin converts to Pug
webpackrequiredpeer dependency: required to run the plugin
Agent activity
8 hits · last 30 days
node
6
Resources
html-webpack-pug-plugin — npm install html-webpack-pug-plugin · libregistry