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
ContactCard.svelte
<script>
import ContactCard from './ContactCard.svelte';
</script>

<ContactCard>
{#snippet name()} P. Sherman {/snippet}

{#snippet address()}
42 Wallaby Way<br />
Sydney
{/snippet}
</ContactCard>

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 ContactCard from './ContactCard.svelte';

var root_2 = $.template(`42 Wallaby Way<br> Sydney`, 1);

export default function App($$anchor) {
{
const name = ($$anchor) => {
$.next();

var text = $.text('P. Sherman');

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

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

var fragment_1 = root_2();

$.next(2);
$.append($$anchor, fragment_1);
};

ContactCard($$anchor, {
name,
address,
$$slots: { name: true, address: true }
});
}
}
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 69
    • end: 205
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (2)
        • Text {...}
          • type: "Text"
          • start: 67
          • end: 69
          • raw: "\n\n"
          • data: "\n\n"
          }
        • Component {...}
          • type: "Component"
          • start: 69
          • end: 205
          • name: "ContactCard"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (5)
              • Text {...}
                • type: "Text"
                • start: 82
                • end: 84
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 84
                • end: 123
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 94
                  • end: 98
                  • name: "name"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 101
                      • end: 113
                      • raw: "P. Sherman"
                      • data: "P. Sherman"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 123
                • end: 126
                • raw: "\n\n\t"
                • data: "\n\n\t"
                }
              • SnippetBlock {...}
                • type: "SnippetBlock"
                • start: 126
                • end: 190
                • expression: Identifier {...}
                  • type: "Identifier"
                  • start: 136
                  • end: 143
                  • name: "address"
                  }
                • parameters: []
                • body: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 146
                      • end: 163
                      • raw: "42 Wallaby Way"
                      • data: "42 Wallaby Way"
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 163
                      • end: 169
                      • name: "br"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 169
                      • end: 180
                      • raw: " Sydney"
                      • data: " Sydney"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 190
                • end: 191
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 67
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 58
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 3
            • column: 0
            }
          }
        • body: [...] (1)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 57
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 48
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 28
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 19
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 28
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 19
                      }
                    }
                  • name: "ContactCard"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 34
              • end: 56
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 25
                  }
                • end: {...}
                  • line: 2
                  • column: 47
                  }
                }
              • value: "./ContactCard.svelte"
              • raw: "'./ContactCard.svelte'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Named render props • Playground • Svelte