从dist文件夹还原Angular 4项目 [英] Restore Angular 4 project from dist folder

查看:534
本文介绍了从dist文件夹还原Angular 4项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我不小心删除了Angular 4项目,但是我仍然有所有文件夹和打包代码的dist文件夹.因此,有什么办法可以恢复所有项目布局,以便我可以继续在编辑器中进行编码,还是永远消失了? 谢谢.

So I accidentally deleted my Angular 4 project but I still have dist folder with all bundles and code packed. So is there any way I can restore all the project layout so I can continue coding in my editor or is it gone forever? Thanks.

推荐答案

否.

如果没有项目文件,则无法对Angular应用程序进行逆向工程以获取源代码.如果编译后的代码与Angular的视图引擎不太紧密(如果您一直在使用最佳实践进行开发,则不应该如此),则可以窥视一下编译后的代码以获取一些业务逻辑,然后尝试恢复它.

If you do not have project files, you cannot reverse-engineer Angular application to get source back. You can take a peek at compiled code to get some business logic if it's not too tied with Angular's view engine (which it shouldn't be if you've been developing with best practices) and try restoring that, though.

这就像试图从只有5个回到2 + 3一样.您不知道它是否是3 + 2,1 + 4,4 +1.Angular编译您的应用程序,并且没有1-1映射. 特别是,当您认为自己也一直在使用TypeScript时. Angular的构建向它输出了两个编译器和一个远离原始的捆绑器.不可逆的.

It's like trying to go back to 2 + 3 from having only 5. You have no idea if it was 3 + 2, 1 + 4, 4 + 1. Angular compiles your application, and there's no 1-1 mapping. Especially when you consider that you've also been using TypeScript. Angular's build output it two compilers and a bundler away from original. Irreversible.

这是有关编译外观的更详细细分.

Here's a more detailed breakdown of how compilation looks like.

  1. 您用TypeScript编写的Angular代码正在被Angular编译器编译为其他TypeScript代码.理论上,此过程可能是可逆的,也可能是不可逆的,具体取决于Angular的编译器的工作方式(我无话可说).
  2. 然后将TypeScript编译为JavaScript.这是不可逆的
  3. 捆绑器(例如Webpack,Rollup,SystemJS或Parcel)使您的代码混乱,包括谁知道多少插件使您的代码混乱.其中大多数是不可逆的.实际的捆绑可能是可逆的,具体取决于实施方式.
  4. 将生成的包(或单个包)最小化.不可逆性还取决于缩小的程度.例如,如果您使用具有高级设置的Google Closure Compiler,从定义上讲,取回原始代码是不可逆的.

这篇关于从dist文件夹还原Angular 4项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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