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

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

Closed
wants to merge 3 commits into from

Conversation

daifee
Copy link

@daifee daifee commented Oct 12, 2017

issues 724

#724

# issues 724
jantimon#724
@mastilver
Copy link
Collaborator

Thank you for having a go at this issue :)

But I think the best way to solve that issue would be that html-webpack-plugin takes an array of config

So rather that instantiate multiple plugins, we would only have one. How does that sounds to you?

Also tests would be awesome! ;)

@daifee
Copy link
Author

daifee commented Oct 13, 2017

"html-webpack-plugin takes an array of config" can not solve this issue, The root of this issue is cache.

when a file has been changed, compiler will recompile and trigger plugin('make', cb), then html-webpack-plugin will create new childCompiler, and run compile for all html. it is slow.

you should avoid create new childCompiler, when the html has not been changed.

@daifee
Copy link
Author

daifee commented Oct 13, 2017

can you merge the pr, and publish a feature fix version?

khronosleung added a commit to zuzucheFE/guido that referenced this pull request Oct 13, 2017
html-webpack-plugin构建存在性能问题,暂时更换使用html-webpack-plugin-for-multihtml

PR: jantimon/html-webpack-plugin#797
@AlexStacker
Copy link

这个确实减少了很多的编译时间,之前11个页面更新其中的一个就需要全部编译,花40s左右,现在基本上6s就行了,但是还有一个问题,就是我更新了index.pug仍然会产生很多次的编译。不知道是不是配置的问题。

This is really a lot of compilation time, before 11 pages to update one of them need to compile all, spend 40s or so, now basically 6s on the line, but there is a problem that I updated the index.pug will still produce a lot Compile time. Do not know if the configuration is not the problem.

image

@khronosleung
Copy link

@loopArray It is recommended to send configuration, my project test did not appear this situation

@AlexStacker
Copy link

AlexStacker commented Oct 13, 2017

My fault, just debugging again, I want to find a place to cry for a while!
Traversed again when the local template file, nested loops two times, and this bug actually always existed, I did not find and I was looking for reasons why html-webpack-plugin multiple html so slow.
image

@jinker
Copy link

jinker commented Oct 28, 2017

@loopArray 我也遇到类似问题,你可以看看这个pr可不可以解决 #802

@mastilver
Copy link
Collaborator

@loopArray 我也遇到类似问题,你可以看看这个pr可不可以解决 #802

@jinker I don't mind a few words in a foreign language (just to say hi ;) ), but please keep the conversation in English please

@mastilver
Copy link
Collaborator

@daifee I'm closing this in flavor of #802 as I find the code simpler and it doesn't add a new variable

Let me know if you disagree! :)

@mastilver mastilver closed this Oct 28, 2017
@daifee
Copy link
Author

daifee commented Oct 30, 2017

@jinker @mastilver i also tried to do so, and it only reduce 50% time(at my project, recompilation takes 20s).

at my project, the task of compile template is very complex, so childCompiler.compileTemplate() is slow. multiple pages will take long time.

the template has not been changed, it should not be recompilated.

@mastilver
Copy link
Collaborator

@daifee Correct me if I'm wrong but this doesn't to do with multiple pages... It's a caching issue (#680) and it's just because you have multiple pages you get hit by that more heavily than others

@daifee
Copy link
Author

daifee commented Oct 30, 2017

@mastilver I think so, my project is more heavily. i has forked html-webpack-plugin, and published html-webpack-plugin-for-multihtml to solve my issue.

@daifee
Copy link
Author

daifee commented Oct 30, 2017

@mastilver Thanks your feedback.

@xilin
Copy link

xilin commented Jan 4, 2018

@daifee Thanks for your work! Using your fork make our project's build time reduce from 10s -> 0.8s.

Could you share the profile experience on how to locate the time consuming part in webpack building? I tried to use --progress and --profile, but the only thing I can tell is that asset optimization phase is slow.

@c7ming
Copy link

c7ming commented Jan 17, 2018

@daifee
OMG... I really want to say love you so much...
This issue distracting our dev for a long time.
Finally, it is resolved by your Repo.
Our project rebuild time reduced from 30+s => 1s..

@daifee
Copy link
Author

daifee commented Jan 18, 2018

@xilin view the source code of html-webpack-plugin.

@lock
Copy link

lock bot commented May 31, 2018

This pull request 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 May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants