-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Recompiling all entry templates after changes of a non-entry partial file leads to long project rebuild #66
Comments
Hello, could you describe what you are doing, concrete steps?
P.S. we only speak english, please use google translate |
Thanks, I will research your case. Notewhen you change a globally used SCSS file, e.g. WorkaroundIf you have a large project, it is recommended that you define only one Pug file in the entry that you currently work on. |
@exocornet |
I will return to this problem a little later. So far, I still do not have time to fully immerse myself in the task. Thank you for your interest and for your concern! |
I didn't quite understand it. I sometimes use this live hack, but I want to get a good job with the compilation of all pages. Thanks for helping! |
The new pug plugin Try to upgrade your project to If the issue is still yet actual, feel free to reopen this issue. |
Hello. I tried the new version of the plugin v5. Nothing changed. It still takes a long time to reassemble everything. :'(( |
I’m also trying to switch to RSPack and it shows an error adding a plugin as in this answer webdiscus/html-bundler-webpack-plugin#55 (comment) . I would be grateful if we can fix this too. I wouldn’t want to switch to old solutions and plugins since your plugin is good and I really like it. Thank you for its development and timely support. |
using the version
P.S. This does not affect performance, but simplifies plugin config. |
back to the topic... Please create a repository with a reproducible performance issue. I don't have a project as big as yours, so it's difficult for me to reproduce the problem. But it is very important for me to research and fix the performance issue. |
Of course, here's the repository - https://github.com/exocornet/pug-plugin-test . This template is my personal customization and if you are interested in something, you can take it for your personal use. But for now I would like to do a quick reload of pug during development. |
I'm also interested in the question. I did a little research on the "html-bundler-webpack-plugin" plugin and since pug-plugin is written in it. Is there a need for pug-plugin now? As for me, “html-bundler-webpack-plugin” gives all the same capabilities or are there still some differences between these two plugins? |
No differences. But later I will add back the pug specifically See src/index.js The
You can read the History of Pug Plugin.
|
If we talk about pretty in pug, then this setting was most suitable. But she doesn’t do everything as it should :(. I haven’t found the ideal method yet and I use the one on the screenshot. |
wow, you found the workaround to format HTML. But this package formatted HTML not perfectly. P.S. If you find a better npm package for HTML formatting, let me know. |
I looked your test project... The complete project was compiled in 188000ms (over 3 minutes). Firstly, I try to optimise your config. |
Yes, first strat (cold start). The fact that it compiles this way I think is normal. Because you need to collect everything first and then send it for withdrawal. But subsequent reassemblies, when they take the same time as the start, are sad and very strange. And I’m trying to improve this point and somehow raised the question and thought that maybe if your plugin is made for the configuration with an implementation for the request, then maybe this will improve the situation at least a little. (#93) And speed is one of the reasons why I decided to try running my assembly via express + webpack + pug-plugin and am also already planning to switch to RSPack. But so far I don’t understand how to connect it all and make it work. Since your plugin is not implemented for on-demand rendering (#93), and there is still an error in RSPack. For now, I'm making do with the temporary solution 'npm run watch', where you can enter one or more project pages. But this solution also causes a lot of inconvenience. |
I can reproduce the problem with needless recompilation. For example, there are project files:
After changes in
When any file included in the entrypoint file changes, webpack calls the loader for all pages. This is a BUG! I don't know why webpack does this. I'm trying to look deeper into the problem. |
Yes. I understand what you're saying. And here it is possible that the problem is not only in webpack, but also in pug itself. While studying this problem with the pug template engine, I learned that it was created as the main server-side template engine. And I tried to run it in combination with express + pug and it worked very well and quickly. But to my regret, I also need webpack. And it seems to me because of the features of pug and webpack. It would be possible to compile it through a request using the page URL. How I tried to do this in #93 If the plugin - "pug-plugin" could exist in exactly this setting, it seems to me that with such an implementation it would be possible to speed up pug. And also use pug-plugin on the server side with express. But I could be wrong, I don’t have much experience in this and here I’m just guessing from everything I tried and tried to understand the logic of pug + webpack recompilation. |
But here’s how to implement the first launch and assembly via webpack, and subsequently only upon request from the page url. There may also be difficulties here, but perhaps this is not the most difficult situation, like accelerating the reassembly of pug 😄 :) |
By compilation single HTML file w/o any template engine will be sometime the compilation twice called. The same issue with This is really webpack bug, not pug. |
Perhaps you are right. But what I see in this problem is not very similar to my situation. Since for me it simply reassembles all pages, as it should be on the server side without using HMR. And in the problem that you found, you simply called the same rebuild twice. It happens to me once, but that’s all. And plus, this problem is already 4 years old, it may have been fixed a long time ago. |
Tell me, is it possible that your plugin (pug-plugin) can be made to work like this? |
To this day this problem still exists. I can reproduce this reliably when compilation is called twice after change single html file. Yes, this is a slightly different problem, but it may still be indirectly related to the current problem. |
no, the |
Eheh, I understand. Then I will try to further fix the problem. |
I'm still searching for a solution to the problem when the dependent file of one page is changed, but all pages are recompiled. |
NotesTwice recompilationTo fix twice recompilation the same file just add the watchOptions: {
// fix twice recompilation the same file
aggregateTimeout: 600,
}, Compiling all entrypoint files after changes of a non-entry file.When is changed the entrypoint template file, then will be recompiled only this entry file (with dependencies). This is a big problem. Currently I don't see a clever solution, sorry. Perhaps, we need develop own caching system with own dependency tree of template files (possible not for all templating engines). |
Although it was not possible to solve the problem, we have now found the cause. And we know what to do. Thank you very much for your help and your interest. I think it will be possible to solve not only this problem. Thank you very much again! |
Can you tell me whether "pug-plugin" will support RSPack and how soon this might happen? |
The problem is that RSPack is not 100% webpack ready yet. |
in the version
Note:
|
does the fix work for you? For other issue, please open new issue. |
Thank you. I will definitely update to this version. Have you seen this plugin? What's interesting is that it's on rsbuild. Although I am attracted by the more native component of rspack. But suddenly this solution will help solve some problems. |
It is very primitive and don't have reach functionality as my plugin ;-) |
Well, the problem itself was never solved. The problem was the long reassembly of the project. When in other frameworks or template engines this all happens instantly. :( But if you have nothing else to help you with, then of course close it. I am grateful to you for such help. Thank you! |
Got it, okay. I was just thinking maybe what mechanism could be implemented so that your plugin would be even better 😊 |
Your project is very big, over 40 pages, over 800 source files. |
Well, I think you've improved anyway. I will still try to find something that would work faster 😁 and HMR would be million-bearing. I think I will turn to you more than once for advice or opinion. Thank you! |
No special rspack mechanism was found.
|
Yes, sure. Thank you for help to improve this plugin! |
I found why your project is builded too long. I have saved the rendered SVG into separate svg file and added one in the - include include-svg/world-map
+ img(src='IMAGES/statisticsMap.svg' class=styles.statisticsMapWorldMap) Build time for one page with SVG as Pug: Total compilation of all pages takes My recommendationYou can pre-render all variants of SVG images (with all variables) and use a variable name of the SVG file instead of rendering SVG "on fly". |
Hello.
Website have 30 pages and 50 components.
Changing something in the component recompiles for a long time up to 3 minutes. Can you tell me how to incrementally build pug files and components?
Thank you.
The text was updated successfully, but these errors were encountered: