[英]Which files are generated when executing `dart2js`? and why?
dart2js probably generates .js.map
, .js.deps
and .precompiled.js
. dart2js可能生成
.js.map
, .js.deps
和.precompiled.js
。
What's the purpose of them? 他们的目的是什么? and I donno why
dart2js
doens't remove them after finishing compile. 而且我不知道为什么
dart2js
在完成编译后不会删除它们。
All files are generated by dart2js on purpose: 所有文件都是由dart2js有意生成的:
.js : The JavaScript output of your application .js :应用程序的JavaScript输出
.precompiled.js : The JavaScript output but with content security policy (CSP) support .precompiled.js :JavaScript输出但具有内容安全策略(CSP)支持
.js.map : source map file used for debugging the JavaScript code in the browser. .js.map :用于在浏览器中调试JavaScript代码的源映射文件。 It contains a mapping from JavaScript to Dart code lines.
它包含从JavaScript到Dart代码行的映射。
.js.deps : contains a list list of all references files used for compilation, prop ably for debugging but I'm not sure about this. .js.deps :包含用于编译的所有引用文件的列表,适用于调试,但我不确定。
Here is what I believe is correct at the time I write this: 在我写这篇文章的时候,我认为这是正确的:
.js
- the main JavaScript output of dart2js .js
- dart2js的主要JavaScript输出
Convention is to us the -o option to set the generated Javascript filename to end with .dart.js
to differentiate generated Javascript from explicit Javascript in the Dart project. 惯例是-o选项将生成的Javascript文件名设置为以
.dart.js
结尾,以区分生成的Javascript与Dart项目中的显式Javascript。 Eg: 例如:
dart2js -o main.dart.js main.dart
pub-build
does that by default. pub-build
默认情况下会这样做。 The dart.js file assumes this convention is used. dart.js文件假定使用此约定。 Sample Dart .gitignore files often include
*.dart.js
. 示例Dart .gitignore文件通常包含
*.dart.js
。
.js.map
- provides source maps from JavaScript to Dart that make debugging easier .js.map
- 提供从JavaScript到Dart的源映射,使调试更容易
.js.deps
- what files were used when compiling with dart2js .js.deps
- 使用dart2js编译时使用的文件
.info.json
- json file with information about the generated code (if --dump-info
specified) .info.json
- 包含生成代码信息的json文件(如果指定了--dump-info
)
.js_1.part.js
, .js_2.part.js
etc. - parts of deferred imports .js_1.part.js
, .js_2.part.js
等 - 延期进口的部分内容
Sample Dart .gitignore files often include *.js_
to cover these files. 示例Dart .gitignore文件通常包含
*.js_
来覆盖这些文件。
The --deferred-map
option will generate a json file that you must provide a file name for. --deferred-map
选项将生成一个json文件,您必须为其提供文件名。
.precompiled.js
is no longer produced by dart2js .precompiled.js
不再生成.precompiled.js
See: 看到:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.