Registry /
web-framework / base-href-webpack-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.
BaseHrefWebpackPlugin
✓ const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');
✗ const BaseHrefWebpackPlugin = require('base-href-webpack-plugin');
Named export, not default. CommonJS require style. For ESM: import { BaseHrefWebpackPlugin } from 'base-href-webpack-plugin';
BaseHrefWebpackPlugin (default)
✓ import BaseHrefWebpackPlugin from 'base-href-webpack-plugin';
✗ import { BaseHrefWebpackPlugin } from 'base-href-webpack-plugin';
Plugin also has a default export. Named import is recommended for clarity.
BaseHrefWebpackPluginConfig
✓ type BaseHrefWebpackPluginConfig = { baseHref: string }
TypeScript type for options object. Exported from package.
Shows how to add BaseHrefWebpackPlugin to webpack config, requiring both html-webpack-plugin and the plugin itself.
// webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin');
module.exports = {
plugins: [
new HtmlWebpackPlugin(),
new BaseHrefWebpackPlugin({ baseHref: '/' })
]
};
Errors
Common errors & fixes
TypeError: Cannot destructure property 'BaseHrefWebpackPlugin' of 'require(...)' as it is undefined.
Using default import or require incorrectly.
fixUse const { BaseHrefWebpackPlugin } = require('base-href-webpack-plugin'); (named import) Error: Cannot find module 'html-webpack-plugin'
html-webpack-plugin is a peer dependency and not installed.
fixRun npm install --save-dev html-webpack-plugin
Error: webpack.version is not defined - plugin requires webpack 5
Using plugin v3 with Webpack 4 or earlier.
fixUse v2.x for Webpack 4 or upgrade to Webpack 5
Audit
Dependencies
html-webpack-pluginrequiredpeer dependency: plugin requires html-webpack-plugin to operate
webpackrequiredpeer dependency: plugin is a webpack plugin