Registry /
devops / modernizr-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.
ModernizrWebpackPlugin
✓ const ModernizrWebpackPlugin = require('modernizr-webpack-plugin');
✗ import ModernizrWebpackPlugin from 'modernizr-webpack-plugin';
Package uses CommonJS and has no default ESM export; named require is correct.
ModernizrWebpackPlugin (with config)
✓ plugins: [new ModernizrWebpackPlugin({ 'feature-detects': ['input'] })]
✗ plugins: [new ModernizrWebpackPlugin({options: { 'feature-detects': ['input'] }})]
Config is passed directly to the constructor, not nested under 'options'.
htmlWebpackPlugin option
✓ new ModernizrWebpackPlugin({ htmlWebpackPlugin: true })
✗ new ModernizrWebpackPlugin({ htmlWebpackPlugin: myHtmlPluginInstance })
Passing the plugin instance directly works but is deprecated in favor of boolean or array.
Shows basic webpack config with Modernizr plugin, feature detection list, and html-webpack-plugin integration.
const ModernizrWebpackPlugin = require('modernizr-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: __dirname + '/dist'
},
plugins: [
new HtmlWebpackPlugin(),
new ModernizrWebpackPlugin({
'feature-detects': [
'input',
'canvas',
'css/resize'
],
minify: process.env.NODE_ENV === 'production' ? true : false
})
]
};
Errors
Common errors & fixes
Error: Cannot find module 'modernizr-webpack-plugin'
Package not installed or using wrong import syntax in ESM environment.
fixRun: npm install modernizr-webpack-plugin --save-dev. Use require() instead of import.
TypeError: ModernizrWebpackPlugin is not a constructor
Importing from the package incorrectly (e.g., using default import in ESM).
fixUse: const ModernizrWebpackPlugin = require('modernizr-webpack-plugin'); Error: html-webpack-plugin not found or not compatible
html-webpack-plugin not installed or incompatible version (requires version 2.x or 3.x).
fixInstall html-webpack-plugin@3.2.0 or use htmlWebpackPlugin: false.
Audit
Dependencies
webpackrequiredRuns as a webpack plugin during compilation
html-webpack-pluginoptionalOptional integration for injecting Modernizr script into HTML