First-class support for secondary entrypoints in Angular libraries as individual nx projects #23343
daiscog
started this conversation in
Feature Requests
Replies: 2 comments 2 replies
-
I've converted this to a discussion so we can discuss more easily. |
Beta Was this translation helpful? Give feedback.
2 replies
-
I think it would be great if entry points were treated as libraries by Nx. This would help avoid adding unnecessary boilerplate configurations like tsconfig, package.json, and project.json, especially since, at least in the projects I work on, the configuration is always the same |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Allow individual entrypoints inside a buildable, publishable lib to be treated as individual nx projects, with full support for individual and cacheable builds, and dependency linting.
Motivation
We want to achieve the following structure:
We have many libs in many domains and we want to be able to use the enforce-module-boundaries lint rule to ensure certain lib types (e.g., feature/util/ui/data) within each domain can only import from certain other types of libs.
But we also don't want to have to publish hundreds of npm packages. Rather, we'd prefer to group our libs into domain-specific packages, where we have separate entrypoints for each lib.
We can sort of do this at the moment, but there are things that do not work so well.
Building
Currently, we have to build the entire package in one go with ng-packagr at the outer level. This means we lose the fine-grained cacheable builds of individual entrypoints. We would prefer if each entrypoint could be individually compiled and the build result be cacheable, so that changing one entry point does not require recompilation of all of the others.
Dependency linting
Where
domain-one
depends onshared/util/something
, the@nx/dependency-checks
lint rule thinks the package.json for@my-org/domain-one
should contain a dependency on@my-org/shared/util/something
instead of the@my-org/shared
package it should depend on.Also, when linting the package.json of the top-level project, the
@nx/dependency-checks
rule does not check that the dependencies of the secondary entrypoint projects are included in the top-level package.json, unless we enable theincludeTransitiveDependencies
- but doing that means we end up with all transitive dependencies being required instead of just the direct dependencies of the secondary entrypoints, which is the behaviour we want.Beta Was this translation helpful? Give feedback.
All reactions