Webpack loader for Pug (formerly Jade) templates, version 2.4.0. Compiles Pug templates to JavaScript template functions at build time. Works with webpack module bundler, supports embedded resources via require(), and can render HTML at compile time using apply-loader. Supports both .pug and legacy .jade files. Options map directly to Pug options. Requires pug ^2.0.0 as a peer dependency. A key differentiator is automatic resolution of includes and inheritance via webpack's module resolution.
npm install pug-loaderVerified import paths — ran on the pinned version, not inferred.
Shows webpack configuration for pug-loader and usage in JavaScript to compile a Pug template with locals.
Replace module.loaders array with module.rules in your webpack config.
Bind pug-loader to .pug files via module.rules and use plain require('./file.pug').Avoid using such plugins or implement custom resolution via webpack aliases.
Ensure module.rules includes test: /\.pug$/ for pug-loader.
Rename .jade files to .pug and update references.
Add a rule in webpack.config.js: { test: /\.pug$/, loader: 'pug-loader' }Install pug v2: npm install pug@2
Remove the plugin or use webpack aliases/resolve for file resolution.