-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter Web Bootstrapping Improvements #144434
Flutter Web Bootstrapping Improvements #144434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, this looks GREAT. I'm updating one of my test apps to use this, see how it goes!
Co-authored-by: David Iglesias <ditman@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been testing this, and it's great. I wonder if the flutter_bootstrap.js file could be minified!
Also, somewhat unrelated to this PR (but IMO relevant for the feature); it'd be nice to have more feedback when the flutter bootstrap falls-back to JS, why.
Right now I have an application deployed that I'd expect to see in --wasm
, but it's falling back to JS (in a supposedly supported browser), and I don't know why!
@@ -58,11 +68,42 @@ class IndexHtml { | |||
return stripLeadingSlash(stripTrailingSlash(baseHref)); | |||
} | |||
|
|||
List<WebTemplateWarning> getWarnings() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if possible, but it'd be nice that these warnings were also emitted on flutter run
.
_Description of what this PR is changing or adding, and why:_ Update Wasm getting started instructions to: - Simplify a bit - Rely on the standard template to ensure they are compatible - Align with bootstrap changes landed in flutter/flutter#144434 ## Presubmit checklist - [ ] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [ ] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [ ] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
_Description of what this PR is changing or adding, and why:_ Update Wasm getting started instructions to: - Simplify a bit - Rely on the standard template to ensure they are compatible - Align with bootstrap changes landed in flutter/flutter#144434 ## Presubmit checklist - [ ] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [ ] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [ ] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
This updates the documentation to be in line with the new changes to bootstrapping that are coming in this PR: flutter/flutter#144434 --------- Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
This makes several changes to flutter web app bootstrapping.
flutter_bootstrap.js
file.flutter_bootstrap.js
file in theweb
subdirectory in the project directory which can have whatever custom bootstrapping logic they'd like to write instead. This file is also templated, and can use any of the tokens that can be used with theindex.html
(with the exception of{{flutter_bootstrap_js}}
, see below).index.html
:{{flutter_js}}
=> inlines the entirety offlutter.js
{{flutter_service_worker_version}}
=> replaced directly by the service worker version. This can be used instead of the script that sets theserviceWorkerVersion
local variable that we used to have by default.{{flutter_bootstrap_js}}
=> inlines the entirety offlutter_bootstrap.js
(this token obviously doesn't apply toflutter_bootstrap.js
itself).IndexHtml
to be calledWebTemplate
instead, since it is used for more than just the index.html now.(const|var) serviceWorkerVersion = null
) and recommends using{{flutter_service_worker_version}}
token insteadFlutterLoader.loadEntrypoint
and recommend usingFlutterLoader.load
insteadflutter_service_worker.js
.index.html
onflutter create
now uses an async script tag withflutter_bootstrap.js
.