There's something I'm not sure to understand with ES6 module import and Angular (although it's not restrcited to Angular)
When I'm importing a component like this :
import { Component } from '@angular/core';
Ok I'm importing the Component class from @angular/core package.
But if I go to node_modules : there's no Component class file at the root of @angular/core. I can see some bundle, esm5, esm2015 and src packages and also files like core.d.ts at the root. How the module loader manages to understand where this Component is located ?
Thanks
When you importing @angular/core
module, it will look for package.json
in the module root that is node_modules/@angular/core
folder. And then look for main
property which is the main entry point of the module. This is the file you want.