Skip to content

HTML files are always emitted HMR #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
moimael opened this issue May 18, 2017 · 9 comments
Closed

HTML files are always emitted HMR #680

moimael opened this issue May 18, 2017 · 9 comments
Labels

Comments

@moimael
Copy link

moimael commented May 18, 2017

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

@mastilver
Copy link
Collaborator

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

@moimael
Copy link
Author

moimael commented May 23, 2017

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

@jantimon
Copy link
Owner

@moimael is that a underlying webpack bug?

@moimael
Copy link
Author

moimael commented May 23, 2017

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.

@nkoterba
Copy link

nkoterba commented Oct 3, 2017

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.

@gkatsanos
Copy link

Any updates?

@jantimon
Copy link
Owner

jantimon commented Mar 1, 2018

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

@jantimon
Copy link
Owner

jantimon commented Jun 4, 2018

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.

@stale
Copy link

stale bot commented Dec 1, 2018

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.

@stale stale bot added the wontfix label Dec 1, 2018
@stale stale bot closed this as completed Dec 16, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants