@sveltejs/vite-plugin-svelte 7.1.0 → 7.1.1
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
|
@@ -39,14 +39,18 @@ export function loadCompiledCss(api) {
|
|
|
39
39
|
if (!svelteRequest) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
// we need to re-resolve the ID in case the dep has been optimised by Vite
|
|
43
|
+
// since it would now have a ?v=... query string suffix
|
|
44
|
+
const resolvedId = await this.resolve(svelteRequest.filename);
|
|
45
|
+
const moduleId = resolvedId?.id ?? svelteRequest.filename;
|
|
46
|
+
let cachedCss = this.getModuleInfo(moduleId)?.meta.svelte?.css;
|
|
43
47
|
// in `build --watch` or dev ssr reloads getModuleInfo only returns changed module data.
|
|
44
48
|
// To ensure virtual css is loaded unchanged, we cache it here separately
|
|
45
49
|
if (useLocalCache) {
|
|
46
50
|
if (cachedCss) {
|
|
47
|
-
buildWatchCssCache.set(
|
|
51
|
+
buildWatchCssCache.set(moduleId, cachedCss);
|
|
48
52
|
} else {
|
|
49
|
-
cachedCss = buildWatchCssCache.get(
|
|
53
|
+
cachedCss = buildWatchCssCache.get(moduleId);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
|
package/src/preprocess.js
CHANGED
|
@@ -49,15 +49,12 @@ function viteScript() {
|
|
|
49
49
|
const lang = /** @type {'ts'} */ (attributes.lang);
|
|
50
50
|
const { code, map } = await transformWithOxc(content, filename, {
|
|
51
51
|
lang,
|
|
52
|
-
target: 'esnext'
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
preserveValueImports: true
|
|
59
|
-
}
|
|
60
|
-
}*/
|
|
52
|
+
target: 'esnext',
|
|
53
|
+
// oxc strips value imports it considers unused, but in Svelte files
|
|
54
|
+
// these imports may be referenced in the template which oxc cannot see.
|
|
55
|
+
// onlyRemoveTypeImports tells oxc to only strip type-only imports
|
|
56
|
+
// (import type {...}, import { type X }) and preserve all value imports.
|
|
57
|
+
typescript: { onlyRemoveTypeImports: true }
|
|
61
58
|
});
|
|
62
59
|
|
|
63
60
|
mapToRelative(map, filename);
|