【问题标题】:How to deploy a remove development server with Flutter Web?如何使用 Flutter Web 部署移除开发服务器?
【发布时间】:2020-02-25 01:41:20
【问题描述】:

借助 vscode-remote 和 nginx 反向代理,我有时会进行远程开发

flutter run -d chrome --web-port=4000

我想在 http://localhost:4000 以外的其他 IP 上打开 Flutter Web 开发服务器

我可以用 nginx 和 webpack-dev-server 做到这一点

没有办法在除了chrome之外的其他浏览器中打开(chrome的一些代理依赖)

nginx 配置文件

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
        proxy_pass http://localhost:4000;
        proxy_set_header Host $host;
    }
}

【问题讨论】:

    标签: nginx-reverse-proxy flutter-web


    【解决方案1】:

    如果您想在开发过程中在其他浏览器中打开 Flutter Web 应用程序,目前这是不可能的。检查此链接顶部的注释here。一种选择是运行flutter build web 并托管build\web 文件夹。一旦托管,它可以在任何浏览器中打开,例如 Firefox 左右。但我猜你不能在这种模式下调试。

    【讨论】:

      猜你喜欢
      • 2019-09-27
      • 2011-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      • 2014-06-16
      相关资源
      最近更新 更多