ghjbnm ghjbnm -4 years ago 73
AngularJS Question

What is the most sane way to manage dependencies for a AngularJs 1.x webapplication

At the moment Im using a bunch of script elements which are referring cdn/local files which is not so great.

I think I would like to declare all required packages using npm/yarn and serve cdn files with self hosted fallback (is this even a good idea?).

Should i go for a webpack/browserify solution or is this overkill for this purpose (because AngularJs is already handling dependency injection by itself)? Im getting somewhat lost in the amount of frameworks/information about this topic.

Answer Source

This is an opinion question, so we can only try to figure out what we would do given our knowledge of your needs. With that grain of salt:

What you are describing sounds like way overkill. Unless your performance needs are huge, manage your dependencies with npm and package them with your releases. If you really need to, use a build tool to minify and package your resources together (like webpack). There are tons of great JS build tools, and if all of the boilerplate is overwhelming, take a look at something like Yeoman which can help out with that.

In my opinion, a self hosted CDN is probably the worst option possible, because it adds huge support requirements with almost no benefits, because as soon as you stop caring about this project someone else will have to refactor all of your code to new CDNs or local resources.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download