{"id":26626,"library":"vue2svelte","title":"Vue2Svelte","description":"A transpiler that converts Vue Single File Components (SFCs) into Svelte components. Current version 0.0.11 is in early development with sporadic releases. Supports simple HTML, props, data, v-if/v-else/v-for directives, and v-bind. Does not yet support methods, computed properties, lifecycle hooks, v-model, or mixins. Differentiates as a direct Vue-to-Svelte migration tool, but maturity is low. TypeScript type definitions are included.","status":"active","version":"0.0.11","language":"javascript","source_language":"en","source_url":"https://github.com/trickstival/vue2svelte","tags":["javascript","vue","svelte","compiler","transpiler","transform","typescript"],"install":[{"cmd":"npm install vue2svelte","lang":"bash","label":"npm"},{"cmd":"yarn add vue2svelte","lang":"bash","label":"yarn"},{"cmd":"pnpm add vue2svelte","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only. CommonJS require will error.","wrong":"const Vue2Svelte = require('vue2svelte')","symbol":"Vue2Svelte","correct":"import Vue2Svelte from 'vue2svelte'"},{"note":"Default export is a class; named import will be undefined.","wrong":"import { Vue2Svelte } from 'vue2svelte'","symbol":"Vue2Svelte (type)","correct":"import type Vue2Svelte from 'vue2svelte'"},{"note":"compile() is an instance method, not static.","wrong":"Vue2Svelte.compile(component)","symbol":"Compiled result","correct":"const result = new Vue2Svelte(component).compile()"}],"quickstart":{"code":"import Vue2Svelte from 'vue2svelte';\n\nconst vueComponent = {\n  template: `<div><span v-for=\"item in list\">{{ item }}</span></div>`,\n  props: {\n    list: {\n      default: ['item 1', 'item 2']\n    }\n  },\n  data () {\n    return { hello: 'world' }\n  }\n};\n\nconst svelteComponent = new Vue2Svelte(vueComponent);\nconsole.log(svelteComponent.compile());\n// Output: <script>export let list=[\"item 1\",\"item 2\"];let hello=\"world\";</script><div>{#each list as item}<span>{item}</span>{/each}</div>","lang":"typescript","description":"Shows basic usage: instantiate Vue2Svelte with a Vue options object, then call compile() to get a Svelte string."},"warnings":[{"fix":"Only use with simple components that rely solely on template, props, data, and limited directives (v-if, v-for, v-bind).","message":"Many Vue features (methods, computed, lifecycle hooks, v-model, mixins) are not supported. Compilation may produce incomplete or non-functional Svelte code.","severity":"breaking","affected_versions":"<=0.0.11"},{"fix":"Correct usage: `const compiler = new Vue2Svelte(options); compiler.compile();`","message":"Default import is a class; must be instantiated with `new Vue2Svelte(...)`. Do not attempt to call it as a function.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Save the string as a .svelte file and import it with Svelte's bundler plugin.","message":"The output is a raw string, not a Svelte component instance. You must write it to a .svelte file or use Svelte's runtime to compile it further.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `import Vue2Svelte from 'vue2svelte'` (ESM default import).","cause":"Using require() or incorrect import (named instead of default).","error":"TypeError: Vue2Svelte is not a constructor"},{"fix":"Use `new Vue2Svelte(component)` to instantiate.","cause":"Attempting to call Vue2Svelte() as a function without `new`.","error":"Uncaught TypeError: vue2svelte__WEBPACK_IMPORTED_MODULE_0__.default is not a function"},{"fix":"Run `npm install vue2svelte` or check your bundler configuration for ES modules.","cause":"Package not installed or module resolution issue.","error":"Cannot find module 'vue2svelte'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}