Skip to content

Commit 10683b3

Browse files
committed
docs: update create library docs and include watch
1 parent 12462ba commit 10683b3

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

docs/documentation/stories/create-library.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,24 @@ directory for the library beforehand, removing old code leftover code from previ
7878
## Why do I need to build the library everytime I make changes?
7979

8080
Running `ng build my-lib` every time you change a file is bothersome and takes time.
81+
In `Angular CLI` version `6.2` an incremental builds functionality has been added to improve the experience of library developers.
82+
Everytime a file is changed a partial build is performed that emits the amended files.
8183

82-
Some similar setups instead add the path to the source code directly inside tsconfig.
83-
This makes seeing changes in your app faster.
84+
The feature can be using by passing `--watch` command argument as show below;
8485

85-
But doing that is risky.
86-
When you do that, the build system for your app is building the library as well.
87-
But your library is built using a different build system than your app.
88-
89-
Those two build systems can build things slightly different, or support completely different
90-
features.
91-
92-
This leads to subtle bugs where your published library behaves differently from the one in your
93-
development setup.
94-
95-
For this reason we decided to err on the side of caution, and make the recommended usage
96-
the safe one.
97-
98-
In the future we want to add watch support to building libraries so it is faster to see changes.
86+
```bash
87+
ng build my-lib --watch
88+
```
9989

100-
We are also planning to add internal dependency support to Angular CLI.
101-
This means that Angular CLI would know your app depends on your library, and automatically rebuilds
102-
the library when the app needs it.
90+
Note: This feature requires that Angular's Compiler Option [enableResourceInlining](https://angular.io/guide/aot-compiler#enableresourceinlining) is enabled.
91+
This can be done by adding the below in your `tsconfig.lib.json`.
10392

93+
```javascript
94+
"angularCompilerOptions": {
95+
"enableResourceInlining": true,
96+
...
97+
}
98+
```
10499

105100
## Note for upgraded projects
106101

0 commit comments

Comments
 (0)