Parser rejects async arrow function in export default position
Author: Shine-nekoCreated Jul 22, 2026Updated Sep 9, 2026
export default async (x) => x; fails to parse, while Node.js and other engines accept it.
Reproduction
// repro.mjs
export default async (x) => x;SyntaxError: expected token 'function', got '(' in async function declaration at line 1, col 22All parenthesised and unparenthesised forms fail:
export default async () => 1; // fails
export default async x => x; // fails
export default async (a, b) => a + b; // failsClosely related forms that parse fine
This narrows the problem to export default combined with an async arrow:
export default async function (x) { return x; } // ok
const f = async (x) => x; export default f; // ok
export const g = async (x) => x; // okNode accepts every failing form above (verified with node --input-type=module).
Spec
export default takes an AssignmentExpression (ExportDeclaration), and AsyncArrowFunction is reachable from it, so these should parse.
Version
main @ 5718cc81111ceff12d6054ab948146a45bc6e114
Found while running a real-world CLI whose command handlers are written as export default async (options) => { … }.
Source: boa-dev/boa