Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
Profile.svelte
<script>
import Profile from './Profile.svelte';
</script>

<Profile>
{#snippet name()}Bob{/snippet}
{#snippet email()}bob@email.com{/snippet}
</Profile>

<Profile>
{#snippet name()}Alice{/snippet}
{#snippet phone()}12345678{/snippet}
</Profile>

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Profile from './Profile.svelte';

var root = $.template(`<!> <!>`, 1);

export default function App($$anchor) {
var fragment = root();
var node = $.first_child(fragment);

{
const name = ($$anchor) => {
$.next();

var text = $.text('Bob');

$.append($$anchor, text);
};

const email = ($$anchor) => {
$.next();

var text_1 = $.text('bob@email.com');

$.append($$anchor, text_1);
};

Profile(node, {
name,
email,
$$slots: { name: true, email: true }
});
}

var node_1 = $.sibling(node, 2);
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 61
    • end: 250
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (4)
        • Text {...}
          • type: "Text"
          • start: 59
          • end: 61
          • raw: "\n\n"
          • data: "\n\n"
          }
        • Component {...}
          • type: "Component"
          • start: 61
          • end: 156
          • name: "Profile"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (5)
              • Text {...}
                • type: "Text"
                • start: 70
                • end: 72
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 72
                • end: 102
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 82
                  • end: 86
                  • name: "name"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 89
                      • end: 92
                      • raw: "Bob"
                      • data: "Bob"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 102
                • end: 104
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 104
                • end: 145
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 114
                  • end: 119
                  • name: "email"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 122
                      • end: 135
                      • raw: "bob@email.com"
                      • data: "bob@email.com"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 145
                • end: 146
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 156
          • end: 158
          • raw: " "
          • data: " "
          }
        • Component {...}
          • type: "Component"
          • start: 158
          • end: 250
          • name: "Profile"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (5)
              • Text {...}
                • type: "Text"
                • start: 167
                • end: 169
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 169
                • end: 201
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 179
                  • end: 183
                  • name: "name"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 186
                      • end: 191
                      • raw: "Alice"
                      • data: "Alice"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 201
                • end: 203
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 203
                • end: 239
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 213
                  • end: 218
                  • name: "phone"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 221
                      • end: 229
                      • raw: "12345678"
                      • data: "12345678"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 239
                • end: 240
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 59
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 50
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 3
            • column: 0
            }
          }
        • body: [...] (1)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 49
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 40
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 24
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 15
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 24
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 15
                      }
                    }
                  • name: "Profile"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 30
              • end: 48
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 21
                  }
                • end: {...}
                  • line: 2
                  • column: 39
                  }
                }
              • value: "./Profile.svelte"
              • raw: "'./Profile.svelte'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Conditional render props • Playground • Svelte