Skip to content
Write html files to hard disk even when using the webpack dev server or middleware
Branch: master
Clone or download

Latest commit

dependabot and jantimon Bump lodash from 3.10.1 to 4.17.11
Bumps [lodash]( from 3.10.1 to 4.17.11.
- [Release notes](
- [Commits](lodash/lodash@3.10.1...4.17.11)

Signed-off-by: dependabot[bot] <>
Latest commit af642bf Nov 3, 2019


Type Name Latest commit message Commit time
Failed to load latest commit information.
spec fix: Update dependencies Oct 15, 2018
.editorconfig Initial commit Apr 18, 2016
.gitignore Initial commit Apr 18, 2016
.travis.yml feat: Add support for html-webpack-plugin 4 Oct 15, 2018 chore(release): 1.0.1 Oct 19, 2018
LICENSE Initial commit Apr 18, 2016 Support explicit output path (#6) Feb 13, 2017
package-lock.json Bump lodash from 3.10.1 to 4.17.11 Nov 6, 2019
package.json Update peer dependency Jul 17, 2019

Harddisk extension for the HTML Webpack Plugin

npm version Dependency Status Build status js-semistandard-style

Enhances html-webpack-plugin functionality by adding the {alwaysWriteToDisk: true|false} option.

This is an extension plugin for the webpack plugin html-webpack-plugin - a plugin that simplifies the creation of HTML files to serve your webpack bundles.


You must be running webpack on node 0.12.x or higher

Install the plugin with npm:

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

Basic Usage

Require the plugin in your webpack config:

var HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');

Add the plugin to your webpack config as follows:

plugins: [
  new HtmlWebpackPlugin(),
  new HtmlWebpackHarddiskPlugin()

The above configuration will actually do nothing due to the configuration defaults.

As soon as you now set alwaysWriteToDisk to true the generated output of the HtmlWebpackPlugin will always be written to disk. This is very useful if you want to pick up the output with another middleware.

plugins: [
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true
  new HtmlWebpackHarddiskPlugin()

Even if you generate multiple files make sure that you add the HtmlWebpackHarddiskPlugin only once:

plugins: [
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: true,
		filename: 'demo.html'
  new HtmlWebpackPlugin({
		alwaysWriteToDisk: false,
		filename: 'test.html'
  new HtmlWebpackHarddiskPlugin()

If you need to set the output path explicitly (for example when using with webpack-dev-server middleware) then pass in the outputPath option:

new HtmlWebpackHarddiskPlugin({
  outputPath: path.resolve(__dirname, 'views')
You can’t perform that action at this time.