Skip to content

Commit f798084

Browse files
authored
feat(web): support --web-content-hash for entrypoint files (flutter#190153)
Enables content-hashed filenames for web build outputs (`main.dart.<hash>.js`, `.wasm`, `.mjs`) via the optional `--web-content-hash` flag in `flutter build web`. * Adds typed `WebOptions.webContentHash` descriptor to `WebCoreOptionsBundle`. * Implements `_hashAndRenameWebOutput` in `web.dart` to compute SHA-256 digests of compiled entrypoint binaries and rename outputs on disk. * Dynamically discovers hashed entrypoint URLs in `Dart2WebTarget.getBuildConfig` and embeds them into `flutter_bootstrap.js`. * Preserves unhashed `main.dart.wasm.map` to maintain WebAssembly binary `sourceMappingURL` custom section integrity. * Unconditionally prunes stale entrypoint files from `build/web/` across repeated builds. * Fast-fails build if `web/index.html` contains direct `<script src="main.dart.js">` tags or deprecated `FlutterLoader.loadEntrypoint` calls. * Emits post-build serving tip linking to web deployment caching guidance. Fixes flutter#191914 Part of flutter#149031
1 parent 0414680 commit f798084

6 files changed

Lines changed: 1399 additions & 94 deletions

File tree

0 commit comments

Comments
 (0)