generate-asset-webpack-plugin
Sometimes you dynamically want to create files while having access to all the Webpack compilation info.
Install
npm install --save-dev generate-asset-webpack-plugin
Usage
var GenerateAssetPlugin = ; var webpackConfig = plugins: filename: 'index.html' { ; } extraFiles: 'favicon.ico' // other webpack config ...
Example function using the compilation
:
{ var chunk = compilationchunks0; var jsFile = chunkfiles0; var cssFile = chunkfiles1; return `<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Awesome!</title> <link rel="stylesheet" href=""> </head> <body> <div id="app"></div> <script src=""></script> </body> </html> `;};