webpack inject javascript into html online code example
Example: htmlwebpackplugin
//installation
npm install --save-dev html-webpack-plugin
//configuration
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
module.exports = {
entry: 'index.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'index_bundle.js'
},
plugins: [new HtmlWebpackPlugin({
template: "./index.html",
})]
};