@sveltejs/vite-plugin-svelte 6.1.1 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/vite-plugin-svelte",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -8,14 +8,17 @@ const filter = { id: SVELTE_VIRTUAL_STYLE_ID_REGEX };
8
8
  * @returns {import('vite').Plugin}
9
9
  */
10
10
  export function loadCompiledCss(api) {
11
- let isBuildWatch = false;
11
+ let useLocalCache = false;
12
+
12
13
  /** @type{Map<string,any>} */
13
14
  const buildWatchCssCache = new Map();
14
15
  return {
15
16
  name: 'vite-plugin-svelte:load-compiled-css',
16
17
 
17
18
  configResolved(c) {
18
- isBuildWatch = !!c.build?.watch;
19
+ const isDev = c.command === 'serve';
20
+ const isBuildWatch = !!c.build?.watch;
21
+ useLocalCache = isDev || isBuildWatch;
19
22
  },
20
23
 
21
24
  resolveId: {
@@ -34,9 +37,9 @@ export function loadCompiledCss(api) {
34
37
  return;
35
38
  }
36
39
  let cachedCss = this.getModuleInfo(svelteRequest.filename)?.meta.svelte?.css;
37
- // in build --watch getModuleInfo only returns changed module data.
40
+ // in `build --watch` or dev ssr reloads getModuleInfo only returns changed module data.
38
41
  // To ensure virtual css is loaded unchanged, we cache it here separately
39
- if (isBuildWatch) {
42
+ if (useLocalCache) {
40
43
  if (cachedCss) {
41
44
  buildWatchCssCache.set(svelteRequest.filename, cachedCss);
42
45
  } else {