Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is @angular/core/bundles/core.umd.js

I'm trying to explore how angular decorators are declared. I've found a file @angular/core/src/util/decorators.ts where makeDecorator function is defined. I was thinking that I could debug this file using a browser and provided source maps. However, a browser doesn't load @angular/core/src/util/decorators.js file, it loads @angular/core/bundles/core.umd.js which seems to include files from @angular/core/src, including @angular/core/src/util/decorators.js file.

So what is @angular/core/bundles/core.umd.js? Is it a bundle of @angular/core/src files?

There is @angular/core/tsconfig-build.json file that seems to be build configuration file. It seems to have the same structure as tsconfig.json file and is probably used by typescript compiler.

like image 995
Max Koretskyi Avatar asked Oct 18 '22 22:10

Max Koretskyi


1 Answers

After reading some articles on internet, The best I have come up with is umd in core.umd.js stands for universal module definition. So, core.umd.js is nothing but umd version of angular's core.js module.

Now, you may ask what umd is? As the name suggest it's a universal pattern for writing modules in javascript. It is being done for developers to write code in single agreed-upon way.

For more clarification please read-

  1. http://davidbcalhoun.com/2014/what-is-amd-commonjs-and-umd/

  2. https://github.com/umdjs/umd

like image 158
Rahul Singh Avatar answered Oct 21 '22 04:10

Rahul Singh