You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/documentation/copy/en/project-config/Project References.md
-29
Original file line number
Diff line number
Diff line change
@@ -92,34 +92,6 @@ Enabling the [`composite`](/tsconfig#composite) flag changes a few things:
92
92
We've also added support for [declaration source maps](https://github.com/Microsoft/TypeScript/issues/14479).
93
93
If you enable [`declarationMap`](/tsconfig#declarationMap), you'll be able to use editor features like "Go to Definition" and Rename to transparently navigate and edit code across project boundaries in supported editors.
94
94
95
-
## `prepend` with `outFile`
96
-
97
-
You can also enable prepending the output of a dependency using the `prepend` option in a reference:
98
-
99
-
```js
100
-
"references": [
101
-
{ "path":"../utils", "prepend":true }
102
-
]
103
-
```
104
-
105
-
Prepending a project will include the project's output above the output of the current project.
106
-
All output files (`.js`, `.d.ts`, `.js.map`, `.d.ts.map`) will be emitted correctly.
107
-
108
-
`tsc` will only ever use existing files on disk to do this process, so it's possible to create a project where a correct output file can't be generated because some project's output would be present more than once in the resulting file.
109
-
For example:
110
-
111
-
```txt
112
-
A
113
-
^ ^
114
-
/ \
115
-
B C
116
-
^ ^
117
-
\ /
118
-
D
119
-
```
120
-
121
-
It's important in this situation to not prepend at each reference, because you'll end up with two copies of `A` in the output of `D` - this can lead to unexpected results.
122
-
123
95
## Caveats for Project References
124
96
125
97
Project references have a few trade-offs you should be aware of.
@@ -211,7 +183,6 @@ You will need to either set the [`outDir`](/tsconfig#outDir) to an explicit subf
211
183
### Structuring for outFiles
212
184
213
185
Layout for compilations using [`outFile`](/tsconfig#outFile) is more flexible because relative paths don't matter as much.
214
-
One thing to keep in mind is that you'll generally want to not use `prepend` until the "last" project - this will improve build times and reduce the amount of I/O needed in any given build.
215
186
The TypeScript repo itself is a good reference here - we have some "library" projects and some "endpoint" projects; "endpoint" projects are kept as small as possible and pull in only the libraries they need.
0 commit comments