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

<p>These styles...</p>
<Nested />

<style>
p {
color: purple;
font-family: 'Comic Sans MS', cursive;
font-size: 2em;
}
</style>

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

var root = $.template(`<p class="svelte-urs9w7">These styles...</p> <!>`, 1);

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

Nested(node, {});
$.append($$anchor, fragment);
}
result = svelte.compile(source, {
generate: ,
});

p.svelte-urs9w7 {
color: purple;
font-family: 'Comic Sans MS', cursive;
font-size: 2em;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 94
      • end: 194
      • attributes: []
      • children: [...] (1)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 103
            • end: 104
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 103
                • end: 104
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "p"
                        • start: 103
                        • end: 104
                        }
                      ]
                    • start: 103
                    • end: 104
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 105
            • end: 185
            • children: [...] (3)
              • Declaration {...}
                • type: "Declaration"
                • start: 109
                • end: 122
                • property: "color"
                • value: "purple"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 126
                • end: 163
                • property: "font-family"
                • value: "'Comic Sans MS', cursive"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 167
                • end: 181
                • property: "font-size"
                • value: "2em"
                }
              ]
            }
          • start: 103
          • end: 185
          }
        ]
      • content: {...}
        • start: 101
        • end: 186
        • styles: "\n\tp {\n\t\tcolor: purple;\n\t\tfont-family: 'Comic Sans MS', cursive;\n\t\tfont-size: 2em;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 59
    • end: 92
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (5)
        • Text {...}
          • type: "Text"
          • start: 57
          • end: 59
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 59
          • end: 81
          • name: "p"
          • attributes: [...] (1)
            • Attribute {...}
              • type: "Attribute"
              • start: -1
              • end: -1
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • type: "Text"
                  • data: "svelte-urs9w7"
                  • raw: "svelte-urs9w7"
                  • start: -1
                  • end: -1
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • Text {...}
                • type: "Text"
                • start: 62
                • end: 77
                • raw: "These styles..."
                • data: "These styles..."
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 81
          • end: 82
          • raw: " "
          • data: " "
          }
        • Component {...}
          • type: "Component"
          • start: 82
          • end: 92
          • name: "Nested"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        • Text {...}
          • type: "Text"
          • start: 92
          • end: 94
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 57
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 48
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 3
            • column: 0
            }
          }
        • body: [...] (1)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 47
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 38
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 23
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 14
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 23
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 14
                      }
                    }
                  • name: "Nested"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 29
              • end: 46
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 20
                  }
                • end: {...}
                  • line: 2
                  • column: 37
                  }
                }
              • value: "./Nested.svelte"
              • raw: "'./Nested.svelte'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Nested components • Playground • Svelte