Skip to content

Commit 8e1f8f0

Browse files
authored
fix: compatibility with vite-plugin-svelte@7 (#15179)
1 parent 36cb864 commit 8e1f8f0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/famous-apples-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/enhanced-img': patch
3+
---
4+
5+
fix: ensure compatibility with vite-plugin-svelte@7 (use api.filter instead of api.idFilter)

packages/enhanced-img/src/vite-plugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export function image_plugin(imagetools_plugin) {
3131
'@sveltejs/enhanced-img requires @sveltejs/vite-plugin-svelte 6 or higher to be installed'
3232
);
3333
}
34+
const api = svelteConfigPlugin.api;
3435
// @ts-expect-error plugin.transform is defined below before configResolved is called
35-
plugin.transform.filter.id = svelteConfigPlugin.api.idFilter.id;
36+
plugin.transform.filter.id = (api.filter ?? api.idFilter).id; // TODO: idFilter was used by earlier versions of vite-plugin-svelte@6, remove when @7 is required
3637
},
3738
transform: {
3839
order: 'pre', // puts it before vite-plugin-svelte:compile

0 commit comments

Comments
 (0)