将Dart编译成对Minifier友好的javascript:从dartdevc到google-closure-compiler [英] Compiling Dart into minifier friendly javascript: From dartdevc into google-closure-compiler

查看:100
本文介绍了将Dart编译成对Minifier友好的javascript:从dartdevc到google-closure-compiler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种编译器选项最能确保dartdevc生成可与Minifier友好的javascript代码,这些代码可以由Google Closure编译器在ADVANCED模式下进行压缩.

What compiler options are best to ensure that dartdevc generates minifier friendly javascript code which can be compressed by google closure compiler in ADVANCED mode.

请显示一个经过测试的示例,该示例指定1. dartdevc和2. java -jar goolge-closure-compiler.jar作为简单的bash脚本,而没有pub.

Please show a tested example that specifies options for 1. dartdevc, and 2. java -jar goolge-closure-compiler.jar as a simple bash script, without pub.

如果可能,模块类型应为'common',应包括dart_sdk.js,最终结果应为es3或es5,以与所有浏览器兼容,并且所有输出都将进入一个压缩的.js文件.

Module type should be 'common' if possible, dart_sdk.js should be included, the final result should be es3 or es5 for compatibility with all browsers, and all output goes into one compressed .js file.

推荐答案

dartdevc编译器目前不用于生产用途,并且不支持任何类型的高级"优化(例如, Google Closure编译器).我们唯一受支持的优化路径是使用dart2js,这是我们的优化编译器,在许多情况下,其性能均优于或优于Google Closure编译器.

The dartdevc compiler is not meant for production usage at this time, and does not support any sort of "advanced" optimizations (such as those done by the Google Closure Compiler). Our only supported optimization path is using dart2js, our optimizing compiler which in many cases is as good as or better the Google Closure Compiler.

请参见何时应使用dartdevc" 在常见问题"页面上:

See "When should I use dartdevc" on our FAQ page:

只要您正在积极地编写代码,就使用dartdevc.

Use dartdevc whenever you’re actively working on your code.

继续使用dart2js构建已部署的生产应用程序.借助dart2js,您可以进行高级优化(例如摇树)以最大程度地减少下载的代码大小.

Keep using dart2js to build your deployed, production application. With dart2js you get advanced optimizations such as tree shaking to minimize downloaded code size.

很高兴您希望看到dartdevc用于更多的用例,但是我们正在专注于出色的开发人员体验,并在此时将优化用法保留在dart2js中.

I'm excited you'd like to see dartdevc work for more use cases, but we are concentrating on a great developer experience and keeping optimization usage in dart2js at this time.

这篇关于将Dart编译成对Minifier友好的javascript:从dartdevc到google-closure-compiler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆