Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Support path mapping #126

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/ngc.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

module.exports = {

compilerOptions: {
baseUrl: '.'
},
include: [
'./**/*.d.ts',
'./app/app.module.ts',
Expand Down
7 changes: 6 additions & 1 deletion src/ngc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -192,4 +194,7 @@ const NGC_TASK_INFO: TaskInfo = {

export interface NgcConfig {
include: string[];
compilerOptions: {
baseUrl: string;
};
}
1 change: 1 addition & 0 deletions src/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export interface TsCompilerOptions {
outDir: string;
removeComments: boolean;
target: string;
baseUrl: string;
}

const ION_COMPILER_COMMENT = '/* ion-compiler */';
Expand Down