Skip to content
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

Multiple entry points -> multiple html outputs webpack rebuild very slow #724

Closed
ghost opened this issue Jun 29, 2017 · 31 comments
Closed

Comments

@ghost
Copy link

ghost commented Jun 29, 2017

my question is:

  • in my project, i has 70's entries and htmls page. when one entry changed, html-webpack-plugin
    rebuild very slowly, Has anyone ever met ?
@cyqresig
Copy link

cyqresig commented Jul 6, 2017

I met this, too. Rebuilding is rather slow using html-webpack-plugin@2+ on webpack 2 or 3.
I try to downgrade it to 1.7.0, then everything is ok.
But I think it is a serious bug that need to be fixed as soon as possible.

@mastilver
Copy link
Collaborator

mastilver commented Jul 6, 2017

Could you try if it gets better with: #723

@cyqresig
Copy link

cyqresig commented Jul 6, 2017

I try the pr code and it works, and I found that:

  1. Rebuilding has returned to normal, but it is still a little slower than using version 1.7.0,
  2. Initial building is almost 30% slower than using version 1.7.0, and it is almost 25% faster than using version 2.X.

@mastilver
Copy link
Collaborator

@cyqresig thank you for you feedback, we will make sure to improve that!

@ghost
Copy link
Author

ghost commented Jul 13, 2017

@mastilver I try the pr code,but it didn't work .
I used "webpack multicompile " to resolve it

@simon-yxl
Copy link

I met this, too.

@githoniel
Copy link

me two.
when there is 10 entry, rebuild take about 8000ms. i think it's acceptable
when I add to 24 entry, rebuild take about 40000ms.......

@jantimon
Copy link
Owner

Is there a difference between webpack 1 and webpack 3?
Because we have similar issues here: webpack/webpack#5505 (comment)

@githoniel
Copy link

githoniel commented Aug 18, 2017

yes i think it's because of webpack3.
I switch to webpack2, rebuild is only 3000ms.

[0] webpack: Compiling...
[0] webpack: wait until bundle finished: /chunk.2.js
[0] webpack building...
[0]  DONE  Compiled successfully in 3001ms14:45:37
[0]
[0] webpack built 0ee20b12b0698f93c3a9 in 3001ms
[0] Hash: 0ee20b12b0698f93c3a9
[0] Version: webpack 2.7.0
[0] Time: 3001ms

notice that [0] webpack: wait until bundle finished: /chunk.2.js.
It seem that webpack2 only rebuild chunk2.
but in webpack3,there is a full rebuild.

@M-torch99
Copy link

me too,but have some difference ways to solve?

@zooey1184
Copy link

i met it also, i used single rebuild to resolve it, i think if i use multi entry point to build my project, i can build it to single file, at first i build it like this "npm run dev index"(this is process.argv) ; so, everything is easy

@vhmth
Copy link

vhmth commented Feb 28, 2018

Has anyone tried updating to Webpack 4 to see if this fixes whatever issues may be introduced via Webpack 3? Right now this plugin takes up about 50 seconds of a 71-second rebuild time in our main repo.

@jantimon
Copy link
Owner

jantimon commented Mar 1, 2018

Maybe @sokra might know what this performance loss might have caused.

@c7ming
Copy link

c7ming commented Mar 7, 2018

@CharlieLau html-webpack-plugin-for-multihtml this plugin can fix this issue,
@jantimon Is it possible merge the changes?

@jantimon
Copy link
Owner

jantimon commented Mar 7, 2018

Can you give any information which changes improved the performance?

@c7ming
Copy link

c7ming commented Mar 8, 2018

It's html-webpack-plugin-for-multihtml @jantimon

@ImpChiang
Copy link

I used webpack 2.7.0 ,html-webpack-plugin 1.7.0 extract-text-webpack-plugin 2.1.2 to resolve it.

@vhmth
Copy link

vhmth commented Apr 16, 2018

@jyx12138 I mainly use this repo to insert proper file hashes/names into my HTML documents upon builds.

Because of the slowness of this plugin with multiple entries, I opt for no JS/CSS hashed names when running locally and I just compile my EJS templates without this plugin. When I build for prod/staging, I use this plugin to generate the proper HTML documents with file hashes in the name. The main use case for hashes in the name is for CDN caching.

It would be great if we could figure out what happened between version 1.7.0 of this plugin and now that has caused the slowness.

@jantimon
Copy link
Owner

@vhmth the 2.x branch is using the webpack compiler to provide more flexibility about the templating. Unfortunately the underlying webpack api required some work arounds which seem to be really slow for newer webpack versions. Especially in larger projects.

We are currently working on adapting the webpack normal module caching system for this plugin:
https://github.com/webpack/webpack/blob/e54af0ddc3246c45602e5738be212ccac0d41a69/lib/NormalModule.js#L429-L451

If anyone has a good solution in mind please open a pull request.

@funwithtriangles
Copy link

html-webpack-plugin-for-multihtml fixes this. Can it not be merged into the main repo?

@jantimon
Copy link
Owner

@funwithtriangles could you please go into detail how they fix it? the code is 7 month old and is hardly mergable.

@funwithtriangles
Copy link

@jantimon understood! Was just asking to see what the situation was.

@acmeid
Copy link

acmeid commented May 2, 2018

@mastilver Can you provide a temporary solution, please.

@zD98
Copy link

zD98 commented May 15, 2018

Hi, the same question in Webpack 4 and html-webpack-plugin3.
Is there some solutions ?

@jantimon
Copy link
Owner

jantimon commented Jun 4, 2018

The pr (#967) is trying to solve this - if you have time please try if it improves the performance.

@tongjun741
Copy link

@jantimon It's work for me.

@vhmth
Copy link

vhmth commented Jun 10, 2018

Wow @jantimon thank you for getting this over the finish line and putting something out there. You are going to collectively save our eng team hours of wait time per week for builds/deploys to go through haha. :-P

@jantimon
Copy link
Owner

Right now #972 has still build errors on travis - once we find out why we will finally release a new alpha

Repository owner deleted a comment from qianjiahao Sep 17, 2018
@vhmth
Copy link

vhmth commented Sep 23, 2018

@jantimon 🤝 gracias!

@lock
Copy link

lock bot commented Oct 23, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests