[improve vite:cssPlugin] add a cache for this plugin?
See original GitHub issueClear and concise description of the problem
packages/vite/src/node/plugins/css.ts
buildStart() {
...
moduleCache = new Map<string, Record<string, string>>()
...
},
In this line, I want to be able to use local cache. Because every restart will compile once.
In my case , server side use createServer
create vite instance, use vite.middlewares
to render.
But when server side modify code, will restart server and createServer
again, too many less files using too much time, pending(TTFB) every time when vite server restart.
js files won’t.
Suggested solution
maybe like
const needCache = optiosn.xx
moduleCache = needCache ? cache : new Map<string, Record<string, string>>()
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
5 Best WordPress Caching Plugins to Speed Up Your Website ...
Are you looking for the best WordPress caching plugins? Caching helps you speed up your WordPress site and boost performance.
Read more >Optimization – Caching – WordPress.org Forums
WordPress caching is the fastest way to improve performance. If your site is getting hit right now install W3 Total Cache, WP Super...
Read more >10 Best WordPress Cache Plugins to Speed Up a Site
Check out the 10 best WordPress cache plugins for speeding up your web pages and improving the user experience on your site.
Read more >7 Best WordPress Caching Plugins to Boost Site Speed - Kinsta
Caching is an essential part of speeding up your site. Check out some of these free and premium WordPress caching plugins that can...
Read more >How to Install and Configure Breeze WordPress Cache Plugin
It is an excellent practice to have a better load time. Please add the URL of the original files instead of minified files'...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks.
I have found JS files have a version
?v=xxx
, css/less files wouldn’t. All because of this.For SSR, Vite has an API for it, which might help if the framework’s setup. I’m not familiar with the framework enough to tell how to integrate it though, but I’d try to avoid restarting the Vite server as much as possible as you’ve mentioned. I’ll close this as a wontfix, but feel free to keep the discussion going, or as a GitHub discussion if you have any questions!