Aller au contenu
angular challenges logo Angular Challenges

🟢 Static vs Dynamic Import

Challenge #42

Ce contenu n’est pas encore disponible dans votre langue.

Créé par Thomas Laforge

Information

If you are using Nx, you might have encountered this error:

Static imports of lazy-loaded libraries are forbidden.
Library "users" is lazy-loaded in these files:
- apps/nx/static-dynamic-import/src/app/app.config.ts eslint@nx/enforce-module-boundaries

This error is part of the ESLint rule embedded by Nx to prevent people from mixing lazy-loading and eagerly-loading code from the same library. Although this error will not break at runtime or build time, it can lead to consequences for bundle size. The lazy-loaded code will end up in the main bundle, nullifying all the benefits of lazy-loading a library.

Statement

The goal of this challenge is to improve the code architecture to eliminate this ESLint error.

You will learn how to create a library and how to rearrange code.

Contributeurs

Merci à tous les contributeurs qui ont aidé à améliorer cette documentation !

  • tomalaforge