-
Notifications
You must be signed in to change notification settings - Fork 293
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
Prevent webpack compilers from running on every page compile during development #241
Comments
Hey Colby 👋 is this still an issue that needs to be worked on? Anyways let me know 👌 |
yup still a problem! |
Okay thanks. I just wanted to check in first and make sure before I spent any time on the issue. I'll let you know what I come up with 👍 |
aweosme sounds great. im also pretty open to new solutions around the entire plugin chain here. @GuilleAngulo and i worked on it a while back as something that we were hoping would be easy to fit in new capabilities without having to rely on package.json-based scripts which wouldn't actually fall into the build process and may potentially get skipped? (not sure if that's a valid concern) i'd also like to figure out a way to enhance code reuse. we have the util.js with a bunch of request capabilities in there. we did that because we weren't able to easily import the existing functions with the |
So I finally got to give this code a good look over 👀 and think about it. Here's the info on it:
Hopefully that could give us a reference point to check the builds against, allowing for the build to be skipped if needed. I'm going to play around with it and see where that gets me 👍🏻 |
ohhhh thats super interesting. only thought, would that override other's recordsPath or is it per-plugin? |
Hmm I don't know the answer to that, but I'll look into it 👀 Also I haven't quite figured out how to get it working yet 😂 |
this might be worth looking into as well https://nextjs.org/blog/next-12-2#swc-plugins-experimental haven't played with it, so not sure if it'll actually be useful for this use case, but worth thinking about and looking into |
Hey Colby 👋 thanks for the link 👍 Here's the list: I'm not sure if any of those will be of help with this particular issue. Perhaps even something like next-bundle-analyzer. And then we could query that data instead of displaying it to the user, of course 😉 Let me know what you think 😄 |
ah okay so you can't make a custom one? i guess that's where my mind was going, a custom plugin, kinda like we were doing for webpack, but maybe that's not the right route caching sounds like a great strategy! especially if that's a common approach totally open to seeing what you come up with, just hoping to avoid slowing down dev with the processing each time if going the caching route, wonder if there's an apollo caching mechanism to take advantage of too 🤷 but idk how the requests work whether they're all sahred in the same process or not looking forward to seeing what you come up with |
thought just come to mind, should we by default disable these from running on development? that's common isnt it? a caching solution would totally be nice, but wondering if that would make more sense we could add an npm script to manually trigger them to test and an environment variable / flag to enable / disable only other thought is not all of them should be disabled though. Search for instance should always be available, so the problem persists there, as it's used clientside to make search requests |
Nice well I think that would be an easy way to fix the problem! 😂 We could disable the ones we don't want running on the dev server and keep the ones we do want. Maybe that's a good solution? |
that sounds good to me! let's give it a shot |
Hey Colby, sorry it took me so long to get back to you on this issue. Anyways, so I tried coming up with 2 different solutions to fix the issue. The second solution I tried was adding a Webpack plugin called HardSourceWebpackPlugin.
It sounds exactly like what would fix this problem, if we could cache the modules then maybe we could reduce the build time. From running the both of them locally it seems like the 1st solution is the only one that seems to reduce the build time for the plugins. Let me know what you think, and if you want me to push up either of those solutions as a PR. Thanks 👍🏻 |
ah i hope everything is okay, no worries, no rush, and at least if you get in a PR it'll be good for Hacktoberfest :) i'll try to take a look sometime between tomorrow and early next week, will be a busy weekend for me thanks for looking into it |
Hey Colby, I totally thought I replied to this earlier whoops 😅 Which was 2 days before hurricane Ian just smashed into SW Florida! [For the records I said they should wait to go 🙄 ] Anyways hope all is going well with you, let me know if you have any thoughts on those PRs. |
i could only imagine 😓 let's start off with the first one where it'll keep track of if it has ran, want to submit a PR for that? totally open to the caching one too, honestly didnt expect that we'd have to get deeper into the webpack plugin world haha DM me on Twitter or email me or really wherever you want to find me and i'd happily let you test with my WP instance |
Thanks yeah it was an ordeal for for but just us, but the family's of the 1,000s of other stranded people too 🙏🏻 I will go ahead and push up that first PR, and you can look it over. And I'll send over a message on Twitter or discord or something 👍🏻 |
Fixes [#241] Prevent Webpack compilers from running on every page.
Currently our webpack compilers run on every page load which slows down performance a bit during development.
This doesn't impact production as it's statically compiled.
These plugins work by running at compile time to provide features like an RSS feed, OG images, and a sitemap
https://github.com/colbyfayock/next-wordpress-starter/tree/main/plugins
Ideally we can only run this when it will actulaly make a difference to avoid the performance hit during development
https://github.com/colbyfayock/next-wordpress-starter/blob/main/plugins/plugin-compiler.js#L56-L64
The text was updated successfully, but these errors were encountered: