Skip to main content
App.svelte
<script>
let name = 'world';
</script>

<h1>Hello {name}!</h1>

import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";

var root = $.template(`<h1></h1>`);

export default function App($$anchor) {
let name = 'world';
var h1 = root();

h1.textContent = `Hello ${name ?? ""}!`;
$.append($$anchor, h1);
}
result = svelte.compile(source, {
generate:
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • {
    • {
      • type: "Script"
      • start: 0
      • end: 39
      • context: "default"
      }
    • module:
    • css:
    }
The AST is not public API and may change at any point in time