Skip to content

Unnecessary polyfills included in ES2015 output #3086

@concavelenz

Description

@concavelenz

Async functions cause both "Symbol" and "Promise" polyfills but these are guaranteed to be part of ES2015:

This can be seen with:

// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @language_out ECMASCRIPT_2015
// @formatting pretty_print,print_input_delimiter
// @debug true
// ==/ClosureCompiler==

(async  ()=> {
claims={
    "aud": "mailto:nobody@nowhere.org",
    "sub": "https://nowhere.org",
    "exp": parseInt(Date.now()*.001) + 86400
}

vapidToken=new VapidToken(claims);
await vapidToken.generate_keys();
return await vapidToken.sign(claims);
})();

https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540output_file_name%2520default.js%250A%252F%252F%2520%2540language_out%2520ECMASCRIPT_2015%250A%252F%252F%2520%2540formatting%2520pretty_print%252Cprint_input_delimiter%250A%252F%252F%2520%2540debug%2520true%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A(async%2520%2520()%253D%253E%2520%257B%250Aclaims%253D%257B%250A%2520%2520%2520%2520%2522aud%2522%253A%2520%2522mailto%253Anobody%2540nowhere.org%2522%252C%250A%2520%2520%2520%2520%2522sub%2522%253A%2520%2522https%253A%252F%252Fnowhere.org%2522%252C%250A%2520%2520%2520%2520%2522exp%2522%253A%2520parseInt(Date.now()*.001)%2520%252B%252086400%250A%257D%250A%250AvapidToken%253Dnew%2520VapidToken(claims)%253B%250Aawait%2520vapidToken.generate_keys()%253B%250Areturn%2520await%2520vapidToken.sign(claims)%253B%250A%257D)()%253B%250A%250A%250A

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions