diff --git a/packages/@ngtools/webpack/README.md b/packages/@ngtools/webpack/README.md index 7e0fd1e5e809..91df4fa6d1e3 100644 --- a/packages/@ngtools/webpack/README.md +++ b/packages/@ngtools/webpack/README.md @@ -37,6 +37,8 @@ The loader works with the webpack plugin to compile your TypeScript. It's import * `mainPath`. Optional if `entryModule` is specified. The `main.ts` file containing the bootstrap code. The plugin will use AST to determine the `entryModule`. * `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. * `typeChecking`. Optional, defaults to true. Enable type checking through your application. This will slow down compilation, but show syntactic and semantic errors in webpack. +* `exclude`. Optional. Extra files to exclude from TypeScript compilation. +* `compilerOptions`. Optional. Override options in `tsconfig.json`. ## Features 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: diff --git a/packages/@ngtools/webpack/src/plugin.ts b/packages/@ngtools/webpack/src/plugin.ts index e95a35116911..8926a5418467 100644 --- a/packages/@ngtools/webpack/src/plugin.ts +++ b/packages/@ngtools/webpack/src/plugin.ts @@ -32,6 +32,7 @@ export interface AotPluginOptions { // Use tsconfig to include path globs. exclude?: string | string[]; + compilerOptions?: ts.CompilerOptions; } @@ -113,6 +114,14 @@ export class AotPlugin implements Tapable { } catch (err) { throw new Error(`An error happened while parsing ${this._tsConfigPath} JSON: ${err}.`); } + + if (options.hasOwnProperty('compilerOptions')) { + tsConfigJson.compilerOptions = Object.assign({}, + tsConfigJson.compilerOptions, + options.compilerOptions + ); + } + const tsConfig = ts.parseJsonConfigFileContent( tsConfigJson, ts.sys, basePath, null, this._tsConfigPath);