Registry /
web-framework / generate-asset-webpack-plugin
Webpack plugin (v0.3.0) for dynamically generating asset files (like index.html) during compilation, with access to compilation info. Lightweight alternative to html-webpack-plugin with a callback-based API. Released 2015, no recent updates; works with Webpack 1-3 but not v4+. Suitable for simple HTML generation without templating.
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.
Package uses CommonJS; ESM import not supported.
const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
Default export only; named destructuring fails.
const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
Constructor expects an options object, not separate arguments.
new GenerateAssetPlugin({ filename: 'file.txt', fn: (compilation, cb) => cb(null, 'content') })
Shows creating a Webpack config that generates an index.html as an asset, using the plugin's callback API.
const GenerateAssetPlugin = require('generate-asset-webpack-plugin');
const webpack = require('webpack');
const compiler = webpack({
entry: './src/index.js',
output: { path: './dist', filename: 'bundle.js' },
plugins: [
new GenerateAssetPlugin({
filename: 'index.html',
fn: (compilation, cb) => {
const chunk = compilation.chunks[0];
const jsFile = chunk.files[0];
const html = `<!DOCTYPE html><html><head><title>App</title></head><body><script src="${jsFile}"></script></body></html>`;
cb(null, html);
},
extraFiles: ['favicon.ico']
})
]
});
compiler.run((err, stats) => {
if (err) console.error(err);
console.log(stats.toString({ colors: true }));
});
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.