question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[improve vite:cssPlugin] add a cache for this plugin?

See original GitHub issue

Clear 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.

image

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tyouzu1commented, May 19, 2022

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!

Thanks.

I have found JS files have a version ?v=xxx, css/less files wouldn’t. All because of this.

0reactions
bluwycommented, May 19, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found