-
Notifications
You must be signed in to change notification settings - Fork 12k
Workspace - Use angular library without bundling #19018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @prabh-62, There are some downsides to the above and for correctness sake we don't recommend that approach.
This is also briefly mentioned at the end of our library guide: https://angular.io/guide/creating-libraries
I do agree that we should provide a way to build a project and all it's dependencies. This is currently being tracked here: #11002 |
Downsides
We use a monorepo for 10 different angular applications and we have few angular libraries that are referenced in each app
If we have to start 3 libraries in watch mode(on 3 different processes), it requires much more machine resources as well and there are more chances that one of the processes might crash and a dev would have to restart process or investigate. Also, in the CI, we will need to build libraries first by invoking Not to forget debugging (this is the biggest issue), building libraries in separate processes prevents us from debugging and fixing code right in the Also, some developers could make the mistake of editing the library code, but forgetting to build the library, and then scratching their heads. You may close this issue if #11002 closely resembles this issue |
Let me bring this up the rest of the team and see if we still stand by the decision that we favor correctness. With regards to debugging, this should improve in version 11 as we added DTS sourcemaps for libraries, which allows go to def to jump to source directly. Also, you might not be enabling the vendor sourcemaps option. "build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"sourceMap": {
"styles": true,
"scripts": true,
"vendor": true
}, |
Agreed we can do The intent is to treat library code as part of the workspace and make code changes/fixes quickly and without any friction |
Hi @prabh-62, I'd like to thank you for all the input provided. We have discussed this during our team meeting and we mentioned some points:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🚀 Feature request
Angular CLI shouldn't require angular library to be built before being consumed in an angular application residing in the same angular workspace.
Command (mark with an
x
)Description
Current Angular CLI (
v11.0.0-next.6
) requires that the angular library be built before it can be consumed in angular applications.Steps
> npx @angular/cli@11.0.0-next.6 new agency-apps --strict true --createApplication false
> cd agency-apps
> yarn ng generate library @agency/auth
> yarn ng generate application admin-console --routing true --style css
projects/admin-console/src/app/app.component.ts
> yarn start --project admin-console
. Angular CLI will error out since we didn't build library@agency/auth
before startingadmin-console
applicationDescribe the solution you'd like
Angular workspaces should not require developers to build libraries before consuming them. Due to this behaviour, it is required that we, developers put a
postinstall
script which builds all angular libraries so CI doesn't error out while building angular applications. Ideally, angular libraries in workspace should work just like project references in dotnet ecosystem.Describe alternatives you've considered
tsconfig.json
from this code snippetto
> yarn start --project admin-console
This approach doesn't require angular libraries to be built before consuming them in apps
The text was updated successfully, but these errors were encountered: