0

I get the concept of a barrel that let's you import a directory using the index.ts convention.

What I don't get is why the index.ts always seems to export * from the component.ts file.

Shouldn't it use the module.ts file to get all the dependencies?

What am I not understanding?

mtyson
  • 8,196
  • 16
  • 66
  • 106
  • Show that code which you don't understand. – micronyks Oct 01 '16 at 19:27
  • 1
    There are times where you might want something in the barrel for export, but don't want as part of your module. For example, you might have utility libraries that relate to a component you wrote in the same directory as the component module but you might need those functions imported else where. Another example might be model files where you will most likely use it elsewhere if you are using typescript. – Caleb Oct 01 '16 at 19:39
  • 1
    @Caleb - That starts to make sense, thanks :) – mtyson Oct 01 '16 at 19:41
  • Answer: http://stackoverflow.com/questions/39810639/why-index-ts-and-modules-in-angular-2 – Andrei Drynov Oct 29 '16 at 22:05

0 Answers0