Some background:
The hack we were using to share the svelte code between Anki and add-ons broke in Svelte 5, and I think it’s probably not something we could fix on our end.
I did some experimenting with your code to try bundle your own copy of Svelte, but unfortunately could not get things into a working state - I suspect svelte is making assumptions about the components being created in the same bundle.
diff --git a/web/esbuild.config.js b/web/esbuild.config.js
index c3f1b3a..9979621 100644
--- a/web/esbuild.config.js
+++ b/web/esbuild.config.js
@@ -46,8 +46,8 @@ const options = {
treeShaking: production,
sourcemap: !production,
pure: production ? ["console.log", "console.time", "console.timeEnd"] : [],
- watch,
- external: ["svelte", "anki"],
+ // watch,
+ external: ["anki"],
plugins: [
sveltePlugin({
preprocess: sveltePreprocess({
diff --git a/web/package.json b/web/package.json
index 9a33bec..ef9af07 100644
--- a/web/package.json
+++ b/web/package.json
@@ -15,17 +15,17 @@
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"cross-env": "^7.0.3",
- "esbuild": "^0.13.7",
+ "esbuild": "^0.24",
"esbuild-sass-plugin": "^2.2.1",
- "esbuild-svelte": "^0.5.6",
+ "esbuild-svelte": "^0.9",
"eslint": "^8.7.0",
"eslint-plugin-compat": "^4.0.1",
"prettier": "^2.4.1",
"prettier-plugin-svelte": "^2.4.0",
"sass": "^1.49.0",
- "svelte": "^3.43.2",
- "svelte-check": "^2.2.7",
- "svelte-preprocess": "^4.9.8",
+ "svelte": "^5",
+ "svelte-check": "^4",
+ "svelte-preprocess": "^6",
"typescript": "^4.4.4"
},
"browserslist": [
Things still crash on the line
toolbar.toolbar.append({component: LanguageTools, id: "languagetools"});
which as far as I can tell, is when we try to include the component in DynamicallySlottable.svelte
As a workaround, you could perhaps create a HTML fragment that loads and mounts your svelte component, and then pass the HTML to editor_did_init_left_buttons or similar.