-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
When I installed [email protected], I get the following errors. I don't have vite-plugin-enhanced-img-markup on flowbite-svelte nor @flowbite-svelte-texteditor. @sveltejs/[email protected] doesn't have this problem.
[vite] Internal server error: Expected token }
https://svelte.dev/e/expected_token
Plugin: vite-plugin-enhanced-img-markup
File: /Users/shinichiokada/Flowbite/flowbite-svelte/node_modules/.vite/deps/@flowbite-svelte-plugins_texteditor.js?v=4fb80293:undefined:undefined
271: check_target,
272: cleanup_styles,
273: clsx as clsx2,
^
274: component,
275: create_ownership_validator,
It seems vite-plugin-enhanced-img-markup plugin interfering.
The Issue:
The transform property is using an object syntax that's not standard for Vite plugins. In Vite plugins, transform should be a function, not an object with order, filter, and handler properties.
transform: {
order: 'pre', // puts it before vite-plugin-svelte:compile
filter: {
code: /<enhanced:img/ // code filter must match in addition to the id filter set in configResolved hook above
},
async handler(content, filename) {
// ... handler code
}
}
Reproduction
Installation
npx sv create enhanced-img-test
pnpm i -D flowbite-svelte flowbite @sveltejs/enhanced-img
Setup vite.config.ts
- Following https://svelte.dev/docs/kit/images#sveltejs-enhanced-img
- Add an image
/src/images/content-gallery-3.png?enhanced
+page.svelte
<script lang="ts">
import { EnhancedImg, Img } from "flowbite-svelte";
import imagePicture from "/src/images/content-gallery-3.png?enhanced";
</script>
<EnhancedImg src={imagePicture} alt="some alt text" />
Logs
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M2 Pro
Memory: 95.00 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.0 - ~/.nvm/versions/node/v22.17.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v22.17.0/bin/npm
pnpm: 10.13.1 - /opt/homebrew/bin/pnpm
bun: 1.1.8 - ~/.bun/bin/bun
Browsers:
Chrome: 138.0.7204.101
Edge: 138.0.3351.83
Safari: 18.5
npmPackages:
@sveltejs/adapter-auto: ^6.0.1 => 6.0.1
@sveltejs/enhanced-img: ^0.7.0 => 0.7.0
@sveltejs/kit: ^2.23.0 => 2.23.0
@sveltejs/vite-plugin-svelte: ^6.0.0 => 6.0.0
svelte: ^5.36.0 => 5.36.0
vite: ^7.0.4 => 7.0.4
Severity
annoyance
Additional Information
No response