简体   繁体   English

从dist文件夹恢复Angular 4项目

[英]Restore Angular 4 project from dist folder

So I accidentally deleted my Angular 4 project but I still have dist folder with all bundles and code packed. 所以我不小心删除了我的Angular 4项目,但我仍然有所有包和代码打包的dist文件夹。 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. 谢谢。

No. 没有。

If you do not have project files, you cannot reverse-engineer Angular application to get source back. 如果您没有项目文件,则无法对Angular应用程序进行反向工程以获取源代码。 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. 如果它与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. 这就像尝试从只有5回到2 + 3.你不知道它是3 + 2,1 + 4,4 + 1.Angular编译你的应用程序,并没有1-1映射。 Especially when you consider that you've also been using TypeScript. 特别是当你考虑到你也一直在使用TypeScript时。 Angular's build output it two compilers and a bundler away from original. Angular的构建输出两个编译器和一个远离原始的捆绑器。 Irreversible. 不可逆的。

Here's a more detailed breakdown of how compilation looks like. 这是关于编译方式的更详细分类。

  1. Your Angular code written in TypeScript is being compiled to a different TypeScript code by Angular compiler. 用TypeScript编写的Angular代码正由Angular编译器编译为不同的TypeScript代码。 This process in theory might or might not be reversible, depending on how Angular's compiler works (I'm in no position to speak about that). 理论上这个过程可能是可逆的,也可能是不可逆的,这取决于Angular的编译器是如何工作的(我无法谈论这个问题)。
  2. Then TypeScript is compiled down to JavaScript. 然后将TypeScript编译为JavaScript。 This is irreversible 这是不可逆转的
  3. A bundler (such as Webpack, Rollup, SystemJS or Parcel) messes with your code, including who-knows how many plugins mess with your code. 捆绑包(例如Webpack,Rollup,SystemJS或Parcel)会混淆您的代码,包括谁知道有多少插件会破坏您的代码。 Most of them are irreversible. 其中大多数是不可逆转的。 Actual bundling might be reversible depending on implementation. 根据实施情况,实际捆绑可能是可逆的。
  4. Resulting bundles (or a single one) are minified. 产生的捆绑(或单个捆绑)被缩小。 Irreversibility of this also depends on how heavy the minification was. 这种不可逆性还取决于缩小的程度。 For example, if you're using Google's Closure Compiler with advanced settings, getting back the original code is irreversible by definition. 例如,如果您使用Google的Closure Compiler进行高级设置,则根据定义,取回原始代码是不可逆转的。

Deploy the app code in the Dist folder, and then use Google Chrome Developer tools (F12). 在Dist文件夹中部署应用程序代码,然后使用Google Chrome Developer工具(F12)。 Under debugger tab, look under webpack -> src It will show all typescript files. 在调试器选项卡下,查看webpack - > src它将显示所有打字稿文件。 you can copy and past the code provided. 您可以复制并通过提供的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 资产未从项目复制到 Angular 7 库中的 dist 文件夹 - Assets not copied from project to dist folder in Angular 7 library 使用Docker构建角度项目并提取dist文件夹 - Build angular project with docker and extract dist folder 有没有办法在执行 ng build --prod 后从 dist 文件夹中恢复角度(4、5、6、任何版本)源代码? - Is there any way to restore the angular (4,5,6,any version) source code from dist folder after doing ng build --prod? Angular项目(dist文件夹)部署在Websphere应用服务器 - Angular project(dist folder) deployment in Websphere Application server 将我的angular 2项目dist文件夹打包为dropwizard应用程序的资产包 - Packaging my angular 2 project dist folder as an asset bundle for dropwizard application 已从角度5更新为角度6,并且无法再建立dist资料夹 - updated from angular 5 to angular 6 and can't build a dist folder anymore 从AngularJS dist文件夹创建符号链接到另一个Angular.io dist文件夹 - Create symlink from AngularJS dist folder to a different Angular.io dist folder 将Angular 5部署到IIS服务器,从dist文件夹导航的路由不起作用 - Angular 5 deployment to IIS server , navigation routes from dist folder not working 从Angular dist文件夹中检索所有丢失的HTML文件 - Retrieving all lost HTML files from Angular dist folder 资产未复制到角度的dist文件夹中 - Assets not copied to the dist folder in angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM