-
Notifications
You must be signed in to change notification settings - Fork 12
Defining Bundles
TsProject supports a "bundles" property within the tsconfig.json project file. The "bundles" property may contain a list of named bundles. Each bundle must provide an array of source files and may optionally specify bundle configuration settings.
The Typescript source files and their dependencies are packaged as a single Typescript file and output with the bundle name. The Typescript bundle is compiled to a single js javascript file and a single d.ts declaration file.
An array of Typescript source files which may include glob patterns.
The bundle config object is used to override the Typescript project file compiler options for the bundle. The options currently supported are:
- "minify": Controls minification of bundle
- "outDir": Relative directory to output bundle
- "declaration": Controls the output of the bundle declaration d.ts file
- "sourceMap": Controls the output of the bundle source map js.map file
- "removeComments": Controls the output of emitted comments
The following is a sample tsconfig.json showing the "bundles" property:
{
"compilerOptions": {
"module": "amd",
"target": "es5",
"noResolve": false,
"declaration": true,
"diagnostics": true
},
"files": [
"index.ts",
"page.ts",
"common.ts",
"plugin.ts"
],
"bundles": {
"app": {
"files": [ "index.ts" ]
},
"components": {
"files": [
"page.ts",
"plugin.ts"
],
"config": {
"declaration": true,
"outDir": "./bundles"
}
}
}
}
"Bundles": {
"type": "object",
"description": "A list of named bundles",
"items": {
"type": "object",
"description": "The bundle files and configuration settings",
"properties": {
"files": {
"type": "array",
"items": {
"description": "Typescript files to include in the bundle (supports glob patterns)",
"type": "string"
},
"required": [
"0"
]
},
"config": {
"type": "object",
"properties": {
"minify": {
"Description": "Controls minification of output bundle"
"type": "boolean"
}
"outDir": {
"Description": "Relative directory to output bundle"
"type": "string"
}
"sourceMap": {
"Description": "Controls the output of the bundle source map (js.map) file"
"type": "boolean"
}
"declaration": {
"Description": "Controls the output of the bundle definition (d.ts) file"
"type": "boolean"
}
}
}
},
"required": [
"files"
]
}