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: docs/out.md
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ We do not support `--out` as we think its a bad idea for you to use because of t
9
9
*`_references`
10
10
* Code reuse
11
11
* Multiple Targets
12
+
* Isolated Compile
12
13
13
14
## Runtime Errors
14
15
@@ -76,5 +77,24 @@ If you want to reuse a portion of your code in another project, with all that *i
76
77
## Multiple Targets
77
78
Also if you decide to reuse your browser code in something like nodejs (e.g. for *testing* APIs) you are going to need to port it over to a module system or come up with ugly hacks to make the nodejs `global` your new global scope (i.e. `window`).
78
79
80
+
## Isolated Compile
81
+
Files cannot be compiled in isolation. E.g. consider `a.ts`:
82
+
```ts
83
+
moduleM {
84
+
var s =t;
85
+
}
86
+
```
87
+
Will have different output depending upon whether there is a `b.ts` of the form:
88
+
```ts
89
+
moduleM {
90
+
exportvar t =5;
91
+
}
92
+
```
93
+
or
94
+
```ts
95
+
var t =5;
96
+
```
97
+
So `a.ts`[cannot be compiled in isolation](https://github.com/Microsoft/TypeScript/issues/2715).
98
+
79
99
## Summary
80
100
`--out` is really the job of some build tool. And even such a build tool can benefit from the dependency mentions provided by external modules. So we recommend you use external modules and then let the build tool create a single `.js` for you if you so desire.
0 commit comments