我应该使用Browserify或WebPACK中对角1.x的依赖关系的延迟加载 [英] Should I use Browserify or Webpack for lazy loading of dependancies in angular 1.x

查看:212
本文介绍了我应该使用Browserify或WebPACK中对角1.x的依赖关系的延迟加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有角的依赖异步加载在一个大的应用程序,我想 Browserify 或的Webpack 这一点。我知道角2.0将本地支持这一点,但现在我正在寻找一个很好的支持和流行的解决方案。

I would like to have async loading of angular dependencies in a large application and I'm trying to decide between Browserify or Webpack for this. I know angular 2.0 will support this natively but for now I'm looking for a well supported and popular solution.

任何人都可以提供意见,哪些最适合在一个角团队和项目结构最优化的方式。

Can anyone give advice on which ones works best in an angular team and the most optimal way to structure the project.

推荐答案

在我的公司,我们从browserify切换到的WebPack的原因有多种,延迟加载是其中之一。

At my company, we've switched over from browserify to webpack for a multitude of reasons, lazy loading being one of them.

把事情在browserify多捆了一些配置更改,以及特殊的code。这里是一个伟大的指导<一个href=\"http://esa-matti.suuronen.org/blog/2013/04/15/asynchronous-module-loading-with-browserify/\">http://esa-matti.suuronen.org/blog/2013/04/15/asynchronous-module-loading-with-browserify/

Putting things in multiple bundles in browserify took some configuration changes as well as special code. Here is a great guide for that http://esa-matti.suuronen.org/blog/2013/04/15/asynchronous-module-loading-with-browserify/

使用的WebPack,添加一个新的捆绑只是意味着在配置的项文件行额外项文件行。这里是一个快速指南是:<一href=\"https://github.com/petehunt/webpack-howto#7-multiple-entrypoints\">https://github.com/petehunt/webpack-howto#7-multiple-entrypoints.在延迟加载的情况下,你甚至不需要配置文件,这是真棒在任何改变 - 只是用异步要求语法这里详细:<一href=\"https://github.com/petehunt/webpack-howto#9-async-loading\">https://github.com/petehunt/webpack-howto#9-async-loading

With webpack, adding a new bundle just means an extra entry file line in the configuration's entry file line. Here is a quick guide to that: https://github.com/petehunt/webpack-howto#7-multiple-entrypoints. In the case of lazy-loading, you don't even need to change anything in the configuration file, which is awesome - just use the asynchronous require syntax detailed here: https://github.com/petehunt/webpack-howto#9-async-loading

下面是一个非常设置类似于我们在 https://bench.co 在生产中使用的模板。 <一href=\"https://github.com/jeffling/angular-webpack-example/\">https://github.com/jeffling/angular-webpack-example/

Here is a template for a setup very similar to what we use at https://bench.co in production. https://github.com/jeffling/angular-webpack-example/

这篇关于我应该使用Browserify或WebPACK中对角1.x的依赖关系的延迟加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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