考虑以下dart网络应用程序:
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应用程序?
packages
? my_hello.dart
包复制到Web服务器?packages/my_hello/...
或者Dartium是否能够通过给定
pubspec.yaml
来解决依赖关系? 最佳答案
目前,您需要部署packages
文件夹以及代码。 Dartium不使用pubspec.yaml
当前正在进行中的dart2dart
工具,其功能与dart2js
类似-摇树,缩小代码并将所有代码合并到单个可部署的源文件中。有关说明,请参见此dartbug issue,有关Google网上论坛,请参见此recent discussion。
这很可能构成pub deploy
方案的一部分,该方案将用于打包您的应用程序以在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.
关于dart - 如何使用Dart包部署Dart Web应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15242399/