Rainer Hahnekamp - The End of Barrel Files: New Modularization Techniques with Sheriff

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2024

Комментарии • 10

  • @dhavalv
    @dhavalv 4 дня назад

    Talk that I was waiting for. Thank you @Rainer Hahnekamp

    • @RainerHahnekamp
      @RainerHahnekamp 4 дня назад

      You're welcome Dhaval

    • @dhavalv
      @dhavalv 2 дня назад

      @@RainerHahnekamp In your example why do we need to specify '/src': 'nx-lib' ? We only care about the folders within it which are already handled by the config of tagging/modules right ?

    • @RainerHahnekamp
      @RainerHahnekamp 2 дня назад +1

      @@dhavalv Sheriff marks every folder with an index.ts as a module. If I wouldn't have tagged /src then it would have received automatically the tag "noTag" (autoTagging feature).
      Strictly speaking, if you are fine with "noTag", you don't have to specify '/src'.

    • @dhavalv
      @dhavalv 2 дня назад

      ​@@RainerHahnekampThank you for the reply.

    • @RainerHahnekamp
      @RainerHahnekamp 2 дня назад

      @@dhavalv Always Dhaval 👍

  • @skatyan
    @skatyan 10 часов назад

    Is there any article for the same, I would love to watch it but I don't have much free time.

  •  4 дня назад +1

    Really great presentation as always @RainerHahnekamp. So if we want the Nx libs + Sheriff benefits at the same time as Nx requires index.ts by design currently, then how we can prevent developers using that Nx lib barrels (has a tsconfig paths) config not to reintroduce the tree-shaking issue with barrel files Sheriff solved with barrel less config. Is this something we cannot restrict programmatically and should have the team always in mind and not use that index.ts import and keep always empty (and update generated tsconfig from "@app/customers": ["libs/customers/src/index.ts"] to "@app/customers/*": ["libs/customers/src/lib/*"])? Thanks for your view on this.

    • @RainerHahnekamp
      @RainerHahnekamp 3 дня назад +1

      Once you have an nx publishable library, it needs to have a barrel file. That's why I meant don't have so many "barrel modules" and keep them larger. So whenever you create an Nx library you should more think about it as a cacheable unit (which tends to be larger hopefully) and not so much of a module where you want to introduce encapsulation and dependency rules.