Skip to content

Instantly share code, notes, and snippets.

@b-tiwari
Created May 7, 2017 13:55
Show Gist options
  • Select an option

  • Save b-tiwari/d2e8adfb4fe9aaadfe84d07e2483904d to your computer and use it in GitHub Desktop.

Select an option

Save b-tiwari/d2e8adfb4fe9aaadfe84d07e2483904d to your computer and use it in GitHub Desktop.
Webpack2 Beginner's Guide - adding another instance of HtmlWebpackPlugin to webpack.config.js
var HtmlWebpackPlugin = require('html-webpack-plugin');
var package = require('../package.json');
module.exports = {
entry: {
app: "./src/scripts/app.js",
    vendor: Object.keys(package.dependencies),
settings: "./src/scripts/settings.js"
},
output: {
filename: "./dist/[name].bundle.js"
},
watch:true,
resolve: { extensions: [".js", ".ts"] },
plugins: [
new HtmlWebpackPlugin({
hash: true,
title: 'My Awesome application',
myPageHeader: 'Hello World',
template: './src/index.html',
chunks: ['vendor', 'app'],
filename: './dist/index.html' //relative to root of the application
}),
new HtmlWebpackPlugin({
hash: true,
title: 'My Awesome application',
myPageHeader: 'Settings',
template: './src/index.html',
chunks: ['vendor', 'settings'],
filename: './dist/settings.html'
})
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment