Skip to content

[web][tool] flutter build web after a --web-content-hash build leaves build/web without index.html #196452

Closed

Description

@debasmitasarkar

Steps to reproduce

flutter create --platforms=web hash_demo && cd hash_demo
flutter build web --web-content-hash
flutter build web
ls build/web/index.html

Expected results

build/web/index.html exists after every successful flutter build web.

Actual results

ls: build/web/index.html: No such file or directory. The build reports success (✓ Built build/web). Running flutter build web a second time restores index.html. Building with --web-content-hash after a plain build is fine.

flutter build web -v on the second build shows:

web_templated_files: Starting due to {InvalidatedReasonKind.buildKeyChanged ...}
web_templated_files: Complete
web_release_bundle: Starting due to {InvalidatedReasonKind.outputSetRemoval: The following outputs were removed from the output set: .../build/web/main.dart.276ca6e0.js, .../build/web/index.html, .../build/web/flutter_bootstrap.js, ...}

Likely cause

In packages/flutter_tools/lib/src/build_system/targets/web.dart, WebReleaseBundle.outputs includes {OUTPUT_DIR}/index.html and {OUTPUT_DIR}/flutter_bootstrap.js only when _hasWebContentHash. On the next plain build those paths leave the target's output set, so the build system deletes them as stale outputs, after WebTemplatedFiles (a dependency of WebReleaseBundle) has already written the new index.html. The same structure is on master today.

Why it matters

Someone trying the new flag locally and then deploying a plain build from their machine ships a site without index.html.

Flutter Doctor output

Flutter 3.50.0 • channel stable • framework ab29120 • Dart 3.14.0 • DevTools 2.61.0, macOS 26.2 (arm64).

Activity

  1. added
    tool
    platform-web
    a: build
    found in release: 3.5
    team-web
    has reproducible steps
    on Nov 12, 2026
  2. mbcorona commented on Nov 12, 2026

    @mbcorona
    Member

    Thanks for the report and the analysis @debasmitasarkar.
    Routing to the web team.

  3. kevmoo commented on Nov 12, 2026

    @kevmoo
    Contributor

    Looking into this NOW!

  4. self-assigned this
    on Nov 12, 2026
  5. added
    found in release: 3.50
    and removed
    found in release: 3.5
    on Nov 12, 2026
  6. kevmoo commented on Nov 13, 2026

    @kevmoo
    Contributor

    Pr out now: #196491

    @debasmitasarkar – if you're able/willing to sync down a branch and verify locally, I'd appreciate it!

    FWIW: I also uncovered a few other problems that I was able to clean up. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: buildfound in release: 3.50has reproducible stepsplatform-webteam-webtool

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions