Skip to content

[tool][web] Use esbuild to guarantee ES6 compatibility of our generated JS code. #104777

@ditman

Description

@ditman

Problem

Flutter Web currently generates several JS files to integrate with the browser, like flutter.js and flutter_service_worker.js.

While doing changes to those files, it's some times hard to remember what bits of ECMAScript are supported by which versions of each browser, and bugs like this happen:

(And possibly others)

Proposal

Integrate in our build process something like esbuild that would let us:

  • Write the JavaScript in whatever version we want, with the latest features
  • Ensure that said javascript will run in our supported browsers (with --target=es6, for example), regardless of what features we use
  • (optional) Minify the code.

PS: the esbuild pass could also happen as post-processing after a flutter build web, this doesn't need to be necessarily integrated with the flutter tool, so adding the "this may be a good package" label also.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectplatform-webWeb applications specificallyteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform teamwould be a good packageSeparate Flutter package should be made for this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions