Dart:如何设置前导文件以在命令行上运行?

我在dart插件中使用了eclipse,当我运行“ pub build ”时,得到的结果如下。
我已经使用Tomcat将构建目录移动到了VPS,客户端代码可以正常运行。

如何运行服务器端代码(TreeFilesystemServer.dart)?因为我有一些服务器端代码,所以结果说我可能会提供一个preamble文件
我必须提供前言文件吗?前导文件是什么意思?

提前致谢!

1.My project framework.
Main
--web
  --allyEdit
    --TreeFilesystemServer.dart  <=(this is a server side code)
  --Main.css
  --Main.dart  <=(this is the entry point of client )
  --Main.html
--pubspec.lock
--pubspec.yaml


2.Below is the message when I run pub build.
[Info from Dart2JS]:  
Compiling allyEdit_dart|web/allyEdit/TreeFilesystemServer.dart...  
[Warning from Dart2JS on allyEdit_dart|web/allyEdit/TreeFilesystemServer.dart]:  

When run on the command-line, the compiled output might require a preamble file located in:
<sdk>/lib/_internal/lib/preambles.  

[Info from Dart2JS]:  
Took 0:00:04.534259 to compile allyEdit_dart|web/allyEdit/TreeFilesystemServer.dart.  
Built 1649 files to "build".
rn

dart2js编译输出的“前导文件”是一个javascript文件,它设置了一个与浏览器充分相似的JS环境,因此dart2js输出可以在浏览器之外运行。

Dart项目的测试既可以在浏览器中运行,也可以在基于v8的“ d8”独立JavaScript外壳中运行,也可以在Mozilla JS引擎的独立版本“ jsshell”中运行。对于最后两个,编译后的代码需要在编译后的脚本之前执行“前导文件”。dart2js序言文件位于sdk / lib / _internal / compiler / js_lib / preambles中-它们最近被移动到此处,因此一些较早的引用可能指向其他位置。

如果仅在浏览器中运行dart2js编译的代码,则无需提供前导文件。如果要在d8中测试输出,则需要d8前置文件(该文件设置了用于打印的钩子并模拟计时器)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章