Skip to content

Changes deployed on the web-server are not applied when the application’s entry point is located outside the lib folder. #175318

Description

@piotruela

Steps to reproduce

  1. Create sample project with web support (i.e. flutter create web_server_issue --platforms=web)
  2. Move main.dart outside lib folder (i.e. move it into integration_test directory)
  3. Deploy you app to local web server flutter run -d web-server -t integration_test/main.dart
  4. Open url on which you app is served http://localhost:PORT
  5. Apply some changes in your main.dart save and hot restart or hot reload your running app (or both)
  6. Refresh the app (You can even use Ctrl + Shift + R to make sure that cache is invalidated)

Expected results

Applied changes should be visible in the app.

Actual results

Applied changes are not visible. If main.dart is placed under lib directory then it works.

Why do I need it?

I’m working on a solution in Patrol that would let me “hot-restart” my e2e test (both the application code and the test code) so I don’t have to build and deploy the application for every change (called Patrol develop mode). The entry point of my “test-mode application” is a file specifically tailored to the nature of e2e tests, which is why it makes little sense to place it anywhere other than the integration_test folder (certainly not in lib).

Code sample

Code sample
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: Scaffold(backgroundColor: Colors.blue));
  }
}

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.2, on macOS 15.6.1 24G90 darwin-arm64, locale en-PL) [200ms]
    • Flutter version 3.35.2 on channel stable at /Users/me/fvm/versions/3.35.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 05db968908 (3 weeks ago), 2025-08-25 10:21:35 -0700
    • Engine revision a8bfdfc394
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [960ms]
    • Android SDK at /Users/piotrmaszota/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/me/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [662ms]
    • Xcode at /Applications/Xcode-16.3.0.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [6ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [5ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[✓] VS Code (version 1.103.2) [5ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.116.0

[✓] Connected device (3 available) [6.0s]
    • iPhone (Me) (wireless) (mobile) • 00008030-001358CE2ED2402E • ios            • iOS 18.3.2 22D82
    • macOS (desktop)                    • macos                     • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)                       • chrome                    • web-javascript • Google Chrome 140.0.7339.133

[✓] Network resources [373ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.dependency: dartDart team may need to help usf: integration_testThe flutter/packages/integration_test pluginfound in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37fyi-toolFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyt: hot reloadReloading code during "flutter run"team-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions