{"id":20113,"library":"html-webpack-pug-plugin","title":"html-webpack-pug-plugin","description":"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.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/negibouze/html-webpack-pug-plugin","tags":["javascript","webpack","plugin","pug","jade","html-webpack-plugin"],"install":[{"cmd":"npm install html-webpack-pug-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add html-webpack-pug-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add html-webpack-pug-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: provides the HTML generation that this plugin converts to Pug","package":"html-webpack-plugin","optional":false},{"reason":"peer dependency: required to run the plugin","package":"webpack","optional":false}],"imports":[{"note":"Default export, not named. Use import default or require with default property.","wrong":"const { HtmlWebpackPugPlugin } = require('html-webpack-pug-plugin');","symbol":"HtmlWebpackPugPlugin","correct":"import HtmlWebpackPugPlugin from 'html-webpack-pug-plugin';"},{"note":"CommonJS require returns the constructor directly, not an object.","wrong":"const { HtmlWebpackPugPlugin } = require('html-webpack-pug-plugin');","symbol":"HtmlWebpackPugPlugin (CommonJS)","correct":"const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin');"},{"note":"GitHub README example uses ES modules; 'html-webpack-pug-plugin' must be added separately.","wrong":"import HtmlWebpackPugPlugin from 'html-webpack-plugin';","symbol":"HtmlWebpackPlugin","correct":"import HtmlWebpackPlugin from 'html-webpack-plugin';"}],"quickstart":{"code":"// webpack.config.js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst HtmlWebpackPugPlugin = require('html-webpack-pug-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: __dirname + '/dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: 'src/template.pug',\n      filename: 'index.pug',\n      minify: false\n    }),\n    new HtmlWebpackPugPlugin({\n      adjustIndent: false\n    })\n  ]\n};","lang":"javascript","description":"Basic webpack config using html-webpack-pug-plugin with a Pug template, generating a Pug output file."},"warnings":[{"fix":"Use html-webpack-slim-plugin or html-webpack-haml-plugin instead.","message":"Do not use the plugin with Slim or Haml templates; support dropped in v0.1.0.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Avoid setting ast: true; use default mode. If needed, pin vulnerable packages manually.","message":"AST mode (option { ast: true }) uses outdated, vulnerable packages like pug-source-gen.","severity":"deprecated","affected_versions":">=0.1.0 <5.0.0"},{"fix":"Instantiate HtmlWebpackPugPlugin only once in the plugins array.","message":"HtmlWebpackPugPlugin must be added exactly once, even with multiple HtmlWebpackPlugin instances.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Add minify: false to HtmlWebpackPlugin options.","message":"Minify must be set to false on HtmlWebpackPlugin to preserve valid Pug output.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use HtmlWebpackPugPlugin (not HtmlWebpackJadePlugin).","message":"Renamed from 'html-webpack-jade-plugin' in early versions; all exports changed.","severity":"breaking","affected_versions":"<0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin');","cause":"Using destructured require on a default-exported module (e.g., const { HtmlWebpackPugPlugin } = require('...'))","error":"Error: Plugin could not be instantiated: HtmlWebpackPugPlugin is not a constructor"},{"fix":"Ensure HtmlWebpackPlugin is added first in plugins array and is instantiated.","cause":"HtmlWebpackPugPlugin called before HtmlWebpackPlugin, or missing HtmlWebpackPlugin entirely","error":"TypeError: Cannot read property 'options' of undefined"},{"fix":"Set adjustIndent: true or false, not a function.","cause":"Passing adjustIndent option incorrectly (e.g., as a function instead of boolean)","error":"Error: HtmlWebpackPugPlugin: adjustIndent is not a function"},{"fix":"Install pug: npm install --save-dev pug","cause":"Missing pug dependency if template uses pug but not installed","error":"ModuleNotFoundError: Module not found: Error: Can't resolve 'pug'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}