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
MyComponent.svelte
<script>
import MyComponent from './MyComponent.svelte';
let someValue = 'world';
let condition = false;
let clickFunction = null;
</script>

<MyComponent
prop={condition ? someValue : undefined}
on:click={clickFunction}
/>

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
/* App.svelte generated by Svelte v3.51.0 */
import {
SvelteComponent,
create_component,
destroy_component,
init,
mount_component,
noop,
safe_not_equal,
transition_in,
transition_out
} from "svelte/internal";

import MyComponent from './MyComponent.svelte';

function create_fragment(ctx) {
let mycomponent;
let current;

mycomponent = new MyComponent({
props: { prop: condition ? someValue : undefined }
});

mycomponent.$on("click", clickFunction);

return {
c() {
create_component(mycomponent.$$.fragment);
},
m(target, anchor) {
mount_component(mycomponent, target, anchor);
current = true;
},
p: noop,
i(local) {
if (current) return;
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • {
    • html: Fragment {...}
      • start: 146
      • end: 231
      • type: "Fragment"
      • children: [...] (2)
        • Text {...}
          • start: 144
          • end: 146
          • type: "Text"
          • raw: "\n\n"
          • data: "\n\n"
          }
        • InlineComponent {...}
          • start: 146
          • end: 231
          • type: "InlineComponent"
          • name: "MyComponent"
          • attributes: [...] (2)
            • Attribute {...}
              • start: 161
              • end: 201
              • type: "Attribute"
              • name: "prop"
              • value: [...] (1)
                • MustacheTag {...}
                  • start: 166
                  • end: 201
                  • type: "MustacheTag"
                  • expression: ConditionalExpression {...}
                    • type: "ConditionalExpression"
                    • start: 167
                    • end: 200
                    • loc: {...}
                      • start: {...}
                        • line: 9
                        • column: 8
                        }
                      • end: {...}
                        • line: 9
                        • column: 41
                        }
                      }
                    • test: Identifier {...}
                      • type: "Identifier"
                      • start: 167
                      • end: 176
                      • loc: {...}
                        • start: {...}
                          • line: 9
                          • column: 8
                          }
                        • end: {...}
                          • line: 9
                          • column: 17
                          }
                        }
                      • name: "condition"
                      }
                    • consequent: Identifier {...}
                      • type: "Identifier"
                      • start: 179
                      • end: 188
                      • loc: {...}
                        • start: {...}
                          • line: 9
                          • column: 20
                          }
                        • end: {...}
                          • line: 9
                          • column: 29
                          }
                        }
                      • name: "someValue"
                      }
                    • alternate: Identifier {...}
                      • type: "Identifier"
                      • start: 191
                      • end: 200
                      • loc: {...}
                        • start: {...}
                          • line: 9
                          • column: 32
                          }
                        • end: {...}
                          • line: 9
                          • column: 41
                          }
                        }
                      • name: "undefined"
                      }
                    }
                  }
                ]
              }
            • EventHandler {...}
              • start: 204
              • end: 228
              • type: "EventHandler"
              • name: "click"
              • modifiers: []
              • expression: Identifier {...}
                • type: "Identifier"
                • start: 214
                • end: 227
                • loc: {...}
                  • start: {...}
                    • line: 10
                    • column: 12
                    }
                  • end: {...}
                    • line: 10
                    • column: 25
                    }
                  }
                • name: "clickFunction"
                }
              }
            ]
          • children: []
          }
        ]
      }
    • css: undefined
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 144
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 135
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 6
            • column: 0
            }
          }
        • body: [...] (4)
          • 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: "MyComponent"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 34
              • end: 56
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 25
                  }
                • end: {...}
                  • line: 2
                  • column: 47
                  }
                }
              • value: "./MyComponent.svelte"
              • raw: "'./MyComponent.svelte'"
              }
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 59
            • end: 83
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 25
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 63
                • end: 82
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 5
                    }
                  • end: {...}
                    • line: 3
                    • column: 24
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 63
                  • end: 72
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 5
                      }
                    • end: {...}
                      • line: 3
                      • column: 14
                      }
                    }
                  • name: "someValue"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 75
                  • end: 82
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 17
                      }
                    • end: {...}
                      • line: 3
                      • column: 24
                      }
                    }
                  • value: "world"
                  • raw: "'world'"
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 85
            • end: 107
            • loc: {...}
              • start: {...}
                • line: 4
                • column: 1
                }
              • end: {...}
                • line: 4
                • column: 23
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 89
                • end: 106
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 5
                    }
                  • end: {...}
                    • line: 4
                    • column: 22
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 89
                  • end: 98
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 5
                      }
                    • end: {...}
                      • line: 4
                      • column: 14
                      }
                    }
                  • name: "condition"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 101
                  • end: 106
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 17
                      }
                    • end: {...}
                      • line: 4
                      • column: 22
                      }
                    }
                  • value: false
                  • raw: "false"
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 109
            • end: 134
            • loc: {...}
              • start: {...}
                • line: 5
                • column: 1
                }
              • end: {...}
                • line: 5
                • column: 26
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 113
                • end: 133
                • loc: {...}
                  • start: {...}
                    • line: 5
                    • column: 5
                    }
                  • end: {...}
                    • line: 5
                    • column: 25
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 113
                  • end: 126
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 5
                      }
                    • end: {...}
                      • line: 5
                      • column: 18
                      }
                    }
                  • name: "clickFunction"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 129
                  • end: 133
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 21
                      }
                    • end: {...}
                      • line: 5
                      • column: 25
                      }
                    }
                  • value: null
                  • raw: "null"
                  }
                }
              ]
            • kind: "let"
            }
          ]
        • sourceType: "module"
        }
      }
    • module: undefined
    }
The AST is not public API and may change at any point in time