From eb2f93915353f7b5e69ba803aa6d86e7f97003ae Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sun, 9 Oct 2016 02:15:43 +0100 Subject: [PATCH] fix(new): fix relativeRootPath for typeRoots Fix #2206 Close #2597 --- .../angular-cli/blueprints/ng2/files/__path__/tsconfig.json | 2 +- packages/angular-cli/blueprints/ng2/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json b/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json index d69d63ccf7ce..731b5d49c7ab 100644 --- a/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json +++ b/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json @@ -11,7 +11,7 @@ "sourceMap": true, "target": "es5", "typeRoots": [ - "../node_modules/@types" + "<%= relativeRootPath %>/node_modules/@types" ] } } diff --git a/packages/angular-cli/blueprints/ng2/index.js b/packages/angular-cli/blueprints/ng2/index.js index 5ab6aa0fb572..97eb59b378d3 100644 --- a/packages/angular-cli/blueprints/ng2/index.js +++ b/packages/angular-cli/blueprints/ng2/index.js @@ -26,8 +26,8 @@ module.exports = { this.styleExt = options.style; this.version = require(path.resolve(__dirname, '../../package.json')).version; - // Join with / not path.sep as reference to typings require forward slashes. - const relativeRootPath = options.sourceDir.split(path.sep).map(() => '..').join('/'); + // Split/join with / not path.sep as reference to typings require forward slashes. + const relativeRootPath = options.sourceDir.split('/').map(() => '..').join('/'); const fullAppName = stringUtils.dasherize(options.entity.name) .replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase()) .replace(/^./, (l) => l.toUpperCase());