Registry / web-framework / pug-html-loader

pug-html-loader

JSON →
library1.1.7jsnpmunverified

Webpack loader that compiles Pug (formerly Jade) templates into HTML strings. Version 1.1.7 is the latest stable release. It connects Pug's compile function to Webpack's module system, outputting raw HTML that can be further processed by loaders like html-loader or raw-loader. Commonly used in webpack configurations to convert .pug files into plain HTML for bundling. Limited maintenance and lacks TypeScript support.

npm install pug-html-loader
INSTALL
IMPORT
SIG · PUG-HTML-LOADER
P
pug-html-loader
web-frameworkjavascriptv1.1.7
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 html from 'pug-html-loader'
const pugHtmlLoader = require('pug-html-loader')
Loader is typically used in webpack config, not imported directly in source code.
pug-html-loader (as loader string)
{ test: /\.pug$/, use: ['raw-loader', 'pug-html-loader'] }
{ test: /\.pug$/, use: 'pug-html-loader' }
Loader is meant to be used in a chain; raw-loader or html-loader is often required to handle the output.

Webpack configuration using pug-html-loader to compile .pug files to HTML strings.

// webpack.config.js module.exports = { entry: './src/index.js', module: { rules: [ { test: /\.pug$/, use: [ 'raw-loader', 'pug-html-loader' ], options: { data: {} // optional data to pass to pug render } } ] }, output: { filename: 'bundle.js' } };
Debug
Known issues
breakingWebpack 4+ requires `use` array instead of `loader` property.
fix
Change `loaders: [...]` to `use: [...]` in webpack config.
affects: >=4.0.0
deprecatedPackage may not be actively maintained; consider alternatives like `pug-loader`.
fix
Migrate to `pug-loader` (https://github.com/pugjs/pug-loader) for better support.
affects: all
gotchaLoader returns a JavaScript string; nesting with other loaders requires careful chaining.
fix
Use `raw-loader` first to ensure the output is treated as a string, not JavaScript.
affects: all
Errors
Common errors & fixes
Module parse failed: Unexpected token (1:0)
Webpack tries to parse the .pug file as JavaScript without appropriate loader.
fix
Ensure `.pug` files are processed by pug-html-loader in webpack config.
Cannot find module 'pug-html-loader'
Loader not installed in project dependencies.
fix
Run `npm install pug-html-loader --save-dev`.
Upgrade
Version history
1.1.7latest on npm
Audit
Dependencies
pugrequiredPeer dependency for compiling Pug templates
Agent activity
4 hits · last 30 days
node
4
Resources
pug-html-loader — npm install pug-html-loader · libregistry