Registry /
devops / html-webpack-partials-plugin
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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HtmlWebpackPartialsPlugin
✓ const HtmlWebpackPartialsPlugin = require('html-webpack-partials-plugin');
✗ import HtmlWebpackPartialsPlugin from 'html-webpack-partials-plugin';
CommonJS only; no default ESM export available. Use require().
HtmlWebpackPartialsPlugin
✓ const HtmlWebpackPartialsPlugin = require('html-webpack-partials-plugin');
✗ const { HtmlWebpackPartialsPlugin } = require('html-webpack-partials-plugin');
Exported as a single constructor function, not a named export.
HtmlWebpackPartialsPlugin
✓ new HtmlWebpackPartialsPlugin({ path: './partials/header.html' });
✗ new HtmlWebpackPartialsPlugin('./partials/header.html');
Must be instantiated with an object (or array of objects); passing a string directly will fail.
Shows a minimal webpack config with partial plugin injecting a analytics snippet into <head> using an environment variable.
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPartialsPlugin = require('html-webpack-partials-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackPartialsPlugin({
path: path.join(__dirname, 'partials', 'ga.html'),
location: 'head',
priority: 'high',
options: { trackingId: process.env.GA_TRACKING_ID ?? '' }
})
]
};
Errors
Common errors & fixes
Error: Cannot find module 'html-webpack-partials-plugin'
Package not installed or missing from node_modules.
fixRun 'npm install html-webpack-partials-plugin --save-dev' or 'yarn add html-webpack-partials-plugin -D'.
TypeError: HtmlWebpackPartialsPlugin is not a constructor
Possibly importing a named export incorrectly; the plugin is exported as default.
fixUse 'const HtmlWebpackPartialsPlugin = require("html-webpack-partials-plugin");' (CommonJS) or ensure webpack config is not bundled. ValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Plugin instantiation with wrong argument type (e.g., string instead of object).
fixEnsure 'new HtmlWebpackPartialsPlugin({ path: '...' })' is used with an object. Audit
Dependencies
html-webpack-pluginrequiredpeer dependency required for integration; must be >=4.3.0