如何使用dart包部署dart Web应用程序?

考虑以下dart Web应用程序:
import "dart:html";
// assume this is a custom library hosted somewhere on github,i.e. 
// there is a pubspec.yaml entry
//
// dependencies:
//    my_hello:
//      git: http://github.com/foo/my_hello.git
//
import "package:my_hello/my_hello.dart" as hello;

main() {
  query("#message").innerHtml = hello.message;
}

如何在Web服务器上的某个地方部署它(例如作为github页面),以便它可以在Dartium中用作基于dart的Web应用程序?

>我是否必须在Web服务器上创建目录包?
>我是否必须将包my_hello.dart复制到Web服务器?

包/ my_hello / …

或者Dartium是否能够在给定pubspec.yaml的情况下解析依赖关系?

解决方法

目前,您需要部署包文件夹以及代码. Dartium不使用pubspec.yaml

目前正在进行中,有一个dart2dart工具,它与dart2js做类似的事情 – 树摇动,缩小,并将所有代码放入一个可部署的源文件中.请参阅此dartbug issue获取指示,并在google群组中查看此recent discussion.

这可能是pub部署方案的一部分,该方案将用于打包您的应用程序以在Web服务器上进行部署.

另见:what could be a deployment strategy with pubspec on dart
并且:Creating a Javascript deployment set from Dart2js output

更新:Dartbug 6006正在进行中,并表示它的工作方式如下:

It’ll copy everything in “web” into a deploy directory,run dart2dart and dart2js on all the entrypoints,and clean up the Dart source files. This will produce a directory that can be served without any additional steps.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 <div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些