diff --git a/config/ngc.config.js b/config/ngc.config.js index 1237e296..8b00c649 100644 --- a/config/ngc.config.js +++ b/config/ngc.config.js @@ -1,6 +1,8 @@ module.exports = { - + compilerOptions: { + baseUrl: '.' + }, include: [ './**/*.d.ts', './app/app.module.ts', diff --git a/src/ngc.ts b/src/ngc.ts index 7d58b441..204452c9 100644 --- a/src/ngc.ts +++ b/src/ngc.ts @@ -6,7 +6,6 @@ import { endsWith } from './util/helpers'; import { Logger } from './util/logger'; import { getTsConfig } from './transpile'; - export function ngc(context?: BuildContext, options?: BuildOptions, ngcConfig?: NgcConfig) { context = generateContext(context); options = generateBuildOptions(options); @@ -125,6 +124,9 @@ function createTmpTsConfig(context: BuildContext, ngcConfig: NgcConfig) { // force where to look for ts files tsConfig.include = ngcConfig.include; + // change baseUrl to support path mappings + tsConfig.compilerOptions.baseUrl = ngcConfig.compilerOptions.baseUrl; + // save the modified copy into the tmp directory outputJsonSync(getTmpTsConfigPath(context), tsConfig); } @@ -192,4 +194,7 @@ const NGC_TASK_INFO: TaskInfo = { export interface NgcConfig { include: string[]; + compilerOptions: { + baseUrl: string; + }; } diff --git a/src/transpile.ts b/src/transpile.ts index da21ce76..30ceace6 100644 --- a/src/transpile.ts +++ b/src/transpile.ts @@ -191,6 +191,7 @@ export interface TsCompilerOptions { outDir: string; removeComments: boolean; target: string; + baseUrl: string; } const ION_COMPILER_COMMENT = '/* ion-compiler */';