npm html-webpack-plugin code example

Example 1: 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",
    })]
};

Example 2: html webpack plugin

npm install html-webpack-plugin --save-dev

Example 3: html-webpack-plugin npm

npm i --save-dev html-webpack-plugin

Example 4: npm webpack plugin

npm i npm-install-webpack-plugin

Tags:

Html Example