Skip to content

[Proposal] Support --base-href for flutter run #163141

Closed

Description

@markbeij

Use case

I want to test my web app when it runs in a subfolder. When I build the web app, I can use the flag --base-href to supply the correct subfolder the web app will be hosted at. This flag is however not available for the flutter run command.

In VS Code I have the following configuration

{
    "name": "portal (in subfolder)",
    "type": "dart",
    "request": "launch",
    "program": "clients/portal/lib/main.dart",
    "args": [
        "--web-launch-url=http://localhost:8080/preview",
        "--web-port=8080",
        "--web-browser-flag=--disable-web-security",
    ]
},

Adding --base-href=/preview/ as an argument results in the error:
Could not find an option named "base-href".

Proposal

Add --base-href to the flutter run command.

Or maybe consider to support all flags that are supported by flutter build command, if that makes sense.

Activity

  1. markbeij commented on Feb 12, 2025

    @markbeij
    Author

    Workaround for now is to either

    • change the value manually in index.html
    • Add a preLaunchTask to edit index.html

    Downsides for both these workarounds are

    • I've got a change to undo before committing anything to git
    • When launching another configuration, I have to reset base href manually or using preLaunchTask
  2. maheshj01 commented on Feb 13, 2025

    @maheshj01
    Member

    You can use this for a production build flutter build web --base-href /path/
    Labelling this issue as a valid proposal to support base-href to run command

  3. added
    c: new featureNothing broken; request for a new capability
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: proposalA detailed proposal for a change to Flutter
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    on Feb 13, 2025
  4. changed the title [-]Support for --base-href for flutter run[/-] [+][Proposal] Support `--base-href` for flutter run[/+] on Feb 13, 2025
  5. added
    team-webOwned by Web platform team
    fyi-toolFor the attention of Flutter Tool team
    and removed
    team-toolOwned by Flutter Tool team
    on Mar 24, 2025
  6. added
    P3Issues that are less important to the Flutter project
    triaged-webTriaged by Web platform team
    on Apr 2, 2025
  7. added a commit that references this issue on Mar 24, 2026
    1ff4012
  8. added a commit that references this issue on Mar 26, 2026
    ef04621
  9. github-actions commented on Apr 7, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Apr 7, 2026
  11. added a commit that references this issue on Apr 14, 2026
    f3778cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions