Skip to content

[widget-preview] Copy host web directory to widget preview scaffold - #188595

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:investigate-flutter-issue-179577
Jun 26, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
bkonyi:investigate-flutter-issue-179577

Conversation

@bkonyi

@bkonyi bkonyi commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #179577

When flutter widget-preview start is run, it generates a scaffold project. However, it was not copying the host project's web/ directory to the scaffold. This caused web-specific bootstrap resources (like custom index.html or scripts required by dependencies) to be missing, leading to crashes or failures on startup if dependencies required them.

This PR fixes the issue by copying the host project's web/ directory (if it exists) to the scaffold project:

  1. During the initial scaffold generation.
  2. On subsequent startups to ensure any updates in the host's web/ directory are synced to the scaffold.

A unit test has been added to verify that the host web/ directory is correctly copied to the scaffold.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 25, 2026
@flutter-dashboard

Copy link
Copy Markdown

This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled.

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 25, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 26, 2026
@bkonyi bkonyi added the CICD Run CI/CD label Jun 26, 2026
@bkonyi
bkonyi marked this pull request as ready for review June 26, 2026 15:57
@bkonyi
bkonyi requested a review from srawlins June 26, 2026 15:57

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces functionality to copy the host's web directory to the widget preview scaffold directory when starting the widget preview, and includes a test to verify this behavior. Feedback suggests deleting the destination web directory in the scaffold before copying to prevent stale files from persisting on subsequent runs.

srawlins
srawlins previously approved these changes Jun 26, 2026
@bkonyi bkonyi added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Jun 26, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 26, 2026
@bkonyi bkonyi added the CICD Run CI/CD label Jun 26, 2026
@bkonyi
bkonyi requested a review from srawlins June 26, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[widget-preview] Preview crashes when project uses dependancy that requires web setup

2 participants