diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index 3702800c7ba9..938cd8433fce 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -363,7 +363,7 @@ export default class Expression { } const fn = deindent` - function ${name}(${args.join(', ')}) ${body} + ${node.async && 'async '}function${node.generator && '*'} ${name}(${args.join(', ')}) ${body} `; if (dependencies.size === 0 && contextual_dependencies.size === 0) { diff --git a/test/runtime/samples/event-handler-async/_config.js b/test/runtime/samples/event-handler-async/_config.js new file mode 100644 index 000000000000..fab4d998b605 --- /dev/null +++ b/test/runtime/samples/event-handler-async/_config.js @@ -0,0 +1,5 @@ +export default { + html: ` + + `, +}; diff --git a/test/runtime/samples/event-handler-async/main.svelte b/test/runtime/samples/event-handler-async/main.svelte new file mode 100644 index 000000000000..b22a6af92ed7 --- /dev/null +++ b/test/runtime/samples/event-handler-async/main.svelte @@ -0,0 +1 @@ +