Html-webpack-plugin: HTML files are always emitted HMR

Created on 18 May 2017  路  9Comments  路  Source: jantimon/html-webpack-plugin

Hi,

Using this plugin with HMR cause html files to be emitted all the time, even if there are no content change.
I'm using the cache option.
It adds ~3.5s to recompile in HMR mode. If I remove the plugin, HMR is much quicker. (1.9s vs 5.5s)

EDIT: Formatting change were caused by my atom editor. If I diff the files nothing changed but they are still emitted again with caching enabled.

Here is the relevant conf:

    ...Object.keys(apps())
      .map(app => new HtmlWebpackPlugin({
        title: app,
        filename: `${app}.html`,
        chunks: ['manifest', 'vendor', `${app}_vendor`, app],
        cache: true,
        minify: {
          collapseWhitespace: true,
        },
        inject: false,
        template: HtmlWebpackTemplate,
        appMountId: 'app',
        mobile: true,
        meta: [
          {
            title: `${app} | Universal Avenue`,
          },
          {
            'http-equiv': 'Accept-CH',
            content: 'DPR, Viewport-Width, Width',
          },
        ],
        scripts: [
          '/sw-registration.js',
        ],
        window: {
          NODE_ENV: process.env.NODE_ENV,
          API_BASE_PATH: process.env.API_BASE_PATH,
          CLIENT_API_BASE_PATH: process.env.CLIENT_API_BASE_PATH,
          SENTRY_CLIENT_DSN: process.env.SENTRY_CLIENT_DSN,
        },
        alwaysWriteToDisk: true,
      })),
    new HtmlWebpackHarddiskPlugin(),

Seems related to #244

wontfix

Most helpful comment

Any updates?

All 9 comments

Yes, we need to improve the caching mechanism, PR welcome :)

In #263 it seems like there i no interest in fixing it. Otherwise we could just use PR #244 ?

@moimael is that a underlying webpack bug?

Not sure, I mean all other asset works well with hot reload and recompile only what's changed. I only have issue with this plugin. The cache does not seems to work as intended.

Any update to this issue since it's been 5 months now?

I've noticed that my index.html is always emitted. Is this normal behavior if my other assets change and they are injected into my index.html?

My favicon.ico is also always emitted. I'm trying to reduce emitted assets to only those items that change to reduce development time.

Any updates?

Would love to fix this but don't know where to start

Could you please try if the 4.x alpha (#958) helps here?

It's already on npm:

npm i html-webpack-plugin@next

I am also working on an improved cache (#967) which might also solve this issue.

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hp8wvvvgnj6asjm7 picture hp8wvvvgnj6asjm7  路  3Comments

azat-io picture azat-io  路  4Comments

amorphius picture amorphius  路  3Comments

yyx990803 picture yyx990803  路  4Comments

ghaiklor picture ghaiklor  路  3Comments