在角度中使用预构建模块?
我们正在构建一个中型 Angular 应用程序,其中包含许多延迟加载到我们的应用程序中的模块。 我们的生产构建大小总计 7MB,我们在 Azure DevOps 上的构建管道需要大约 6 分钟才能构建它。 现在我们必须包含 Grapecity 的 ActiveReportJS,我们的构建大小达到了 19MB,而且构建时间增加到了 18 分钟。
虽然大小差异看起来与增加的构建时间一样令人震惊,但实际上并非如此:因为我们使用延迟加载,所以我们只有一个新的 11MB 大延迟加载模块。但建造时间确实让我们烦恼。
现在我问自己是否可以提取我们的 ActiveReportJS 包装器模块,预构建它并使用这个预构建的 JS 文件直接在我们的延迟加载设置中导入/使用它(无需每次都构建和优化它)?
或者:是否可以从角度优化和/或buildOptimizer标志中排除特定模块?
有可能吗?以前有人这样做过吗?
We're building a mid sized Angular application that consists of many modules which are lazy loaded into our app.
Our production build size was 7MB total and our build pipeline on Azure DevOps needed approx 6min to build it.
Now we had to include Grapecity's ActiveReportJS and our build size went to 19MB, plus our build time increased to 18min.
While the size difference looks as shocking as the increased built time, it actually is not: Because we use lazy loading, we just have a new 11MB big lazy loaded module. But the built time is really bugging us.
Now I'm asking myself if we can extract our ActiveReportJS wrapper module, pre-build it and use this prebuilt JS-file to directly import/use it in our lazy-loading setup (without building and optimizing it every time)?
Alternatively: Is it possible to exclude specific module from the angular optimization
- and/or buildOptimizer
- flag?
Is it possible and has it been done before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论