Skip to content

Commit 84a3131

Browse files
filipesilvaZhicheng Wang
authored and
Zhicheng Wang
committed
feat(@ngtools/webpack): allow to pass in overrides for compilerOptions
Close angular#4851
1 parent ed9fda1 commit 84a3131

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/@ngtools/webpack/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ The loader works with the webpack plugin to compile your TypeScript. It's import
3737
* `mainPath`. Optional if `entryModule` is specified. The `main.ts` file containing the bootstrap code. The plugin will use AST to determine the `entryModule`.
3838
* `skipCodeGeneration`. Optional, defaults to false. Disable code generation and do not refactor the code to bootstrap. This replaces `templateUrl: "string"` with `template: require("string")` (and similar for styles) to allow for webpack to properly link the resources.
3939
* `typeChecking`. Optional, defaults to true. Enable type checking through your application. This will slow down compilation, but show syntactic and semantic errors in webpack.
40+
* `exclude`. Optional. Extra files to exclude from TypeScript compilation.
41+
* `compilerOptions`. Optional. Override options in `tsconfig.json`.
4042

4143
## Features
4244
The benefits and ability of using [`@ngtools/webpack`](https://www.npmjs.com/~ngtools) standalone from the Angular CLI as presented in [Stephen Fluin's Angular CLI talk](https://youtu.be/uBRK6cTr4Vk?t=6m45s) at Angular Connect 2016:

packages/@ngtools/webpack/src/plugin.ts

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface AotPluginOptions {
3232

3333
// Use tsconfig to include path globs.
3434
exclude?: string | string[];
35+
compilerOptions?: ts.CompilerOptions;
3536
}
3637

3738

@@ -113,6 +114,14 @@ export class AotPlugin implements Tapable {
113114
} catch (err) {
114115
throw new Error(`An error happened while parsing ${this._tsConfigPath} JSON: ${err}.`);
115116
}
117+
118+
if (options.hasOwnProperty('compilerOptions')) {
119+
tsConfigJson.compilerOptions = Object.assign({},
120+
tsConfigJson.compilerOptions,
121+
options.compilerOptions
122+
);
123+
}
124+
116125
const tsConfig = ts.parseJsonConfigFileContent(
117126
tsConfigJson, ts.sys, basePath, null, this._tsConfigPath);
118127

0 commit comments

Comments
 (0)