Svelte/5/Server Api Changes

/icons/calendar.svg

Last update

Sep 10, 2024

This codemod updates Svelte component rendering:

  • Converts calls to Component.render({...}) to render(Component, { props }).
  • Ensures the import statement import { render } from 'svelte/server' is added if render is used.

Before

import App from './App.svelte';
const { html, head } = App.render({ message: 'hello' });

After

import { render } from 'svelte/server';
import App from './App.svelte';
const { html, head } = render(App, {
props: { message: 'hello' },
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now