4

我在某处读到 dart2js 删除了冗余代码和变量。除了 dart2js 之外,dart 中还有其他方法可以测试 Dart 程序中的冗余代码和变量吗?

4

1 回答 1

0

Are you talking about tree-shaking?

If that's the case, see this:

Run the main application through the dart2js tool, which supports tree-shaking for both JavaScript and Dart outputs. Note there is no command-line option for tree shaking, because dart2js is always tree shaking. For simplicity's sake, let's generate Dart.

dart2js --output-type=dart embiggen.dart --categories=Server

Updated answer based on comments: dart2js is meant to be used as part of the build process. It can do tree-shaking as well as other tasks, but it cannot be used as an aid in the development process, i.e. it can't be used to refactor your code. As far as I know there's no such tool available yet.

于 2013-08-29T09:06:48.740 回答