|
| 1 | +--- |
| 2 | +display: "Modulo" |
| 3 | +oneline: "Definisce il sistema di moduli previsto per il runtime" |
| 4 | +--- |
| 5 | + |
| 6 | +Definisce il sistema di moduli per il programma. Consulta la sezione <a href='/docs/handbook/modules.html#ambient-modules'> Moduli </a> per più informazioni. Per i progetti che utilizzano node è probabile che tu voglia `"CommonJS"`. |
| 7 | + |
| 8 | +Questo è un output di esempio: |
| 9 | + |
| 10 | +```ts twoslash |
| 11 | +// @filename: costanti.ts |
| 12 | +export const valoreDiPi = 3.142; |
| 13 | +// ---cut--- |
| 14 | +// @filename: index.ts |
| 15 | +import { valoreDiPi } from "./costanti"; |
| 16 | + |
| 17 | +export const doppioPi = valoreDiPi * 2; |
| 18 | +``` |
| 19 | + |
| 20 | +#### `CommonJS` |
| 21 | + |
| 22 | +```ts twoslash |
| 23 | +// @showEmit |
| 24 | +// @module: commonjs |
| 25 | +// @filename: costanti.ts |
| 26 | +export const valoreDiPi = 3.142; |
| 27 | +// @filename: index.ts |
| 28 | +// ---cut--- |
| 29 | +import { valoreDiPi } from "./costanti"; |
| 30 | + |
| 31 | +export const doppioPi = valoreDiPi * 2; |
| 32 | +``` |
| 33 | + |
| 34 | +#### `UMD` |
| 35 | + |
| 36 | +```ts twoslash |
| 37 | +// @showEmit |
| 38 | +// @module: umd |
| 39 | +// @filename: costanti.ts |
| 40 | +export const valoreDiPi = 3.142; |
| 41 | +// ---cut--- |
| 42 | +// @filename: index.ts |
| 43 | +import { valoreDiPi } from "./costanti"; |
| 44 | + |
| 45 | +export const doppioPi = valoreDiPi * 2; |
| 46 | +``` |
| 47 | + |
| 48 | +#### `AMD` |
| 49 | + |
| 50 | +```ts twoslash |
| 51 | +// @showEmit |
| 52 | +// @module: amd |
| 53 | +// @filename: costanti.ts |
| 54 | +export const valoreDiPi = 3.142; |
| 55 | +// ---cut--- |
| 56 | +// @filename: index.ts |
| 57 | +import { valoreDiPi } from "./costanti"; |
| 58 | + |
| 59 | +export const doppioPi = valoreDiPi * 2; |
| 60 | +``` |
| 61 | + |
| 62 | +#### `System` |
| 63 | + |
| 64 | +```ts twoslash |
| 65 | +// @showEmit |
| 66 | +// @module: system |
| 67 | +// @filename: costanti.ts |
| 68 | +export const valoreDiPi = 3.142; |
| 69 | +// ---cut--- |
| 70 | +// @filename: index.ts |
| 71 | +import { valoreDiPi } from "./costanti"; |
| 72 | + |
| 73 | +export const doppioPi = valoreDiPi * 2; |
| 74 | +``` |
| 75 | + |
| 76 | +#### `ESNext` |
| 77 | + |
| 78 | +```ts twoslash |
| 79 | +// @showEmit |
| 80 | +// @module: esnext |
| 81 | +// @filename: costanti.ts |
| 82 | +export const valoreDiPi = 3.142; |
| 83 | +// ---cut--- |
| 84 | +// @filename: index.ts |
| 85 | +import { valoreDiPi } from "./costanti"; |
| 86 | + |
| 87 | +export const doppioPi = valoreDiPi * 2; |
| 88 | +``` |
| 89 | + |
| 90 | +#### `ES2020` |
| 91 | + |
| 92 | +```ts twoslash |
| 93 | +// @showEmit |
| 94 | +// @module: es2020 |
| 95 | +// @filename: costanti.ts |
| 96 | +export const valoreDiPi = 3.142; |
| 97 | +// ---cut--- |
| 98 | +// @filename: index.ts |
| 99 | +import { valoreDiPi } from "./costanti"; |
| 100 | + |
| 101 | +export const doppioPi = valoreDiPi * 2; |
| 102 | +``` |
| 103 | + |
| 104 | +### `None` |
| 105 | + |
| 106 | +```ts twoslash |
| 107 | +// @showEmit |
| 108 | +// @module: none |
| 109 | +// @filename: costanti.ts |
| 110 | +export const valoreDiPi = 3.142; |
| 111 | +// ---cut--- |
| 112 | +// @filename: index.ts |
| 113 | +import { valoreDiPi } from "./costanti"; |
| 114 | + |
| 115 | +export const doppioPi = valoreDiPi * 2; |
| 116 | +``` |
0 commit comments