diff --git a/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json b/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json index d69d63ccf7ce..1e5a0ffce133 100644 --- a/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json +++ b/packages/angular-cli/blueprints/ng2/files/__path__/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": ".", "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index ec755c36979a..872d25ab7481 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -33,9 +33,13 @@ export function getWebpackCommonConfig( return { devtool: 'source-map', resolve: { - extensions: ['.ts', '.js'] + extensions: ['.ts', '.js'], + modules: [ + path.resolve(projectRoot, appConfig.root), + 'node_modules' + ] }, - context: path.resolve(__dirname, './'), + context: path.resolve(projectRoot, appConfig.root), entry: entry, output: { path: path.resolve(projectRoot, appConfig.outDir), diff --git a/packages/angular-cli/models/webpack-build-test.js b/packages/angular-cli/models/webpack-build-test.js index 403ed91fdeec..9b08136d2b45 100644 --- a/packages/angular-cli/models/webpack-build-test.js +++ b/packages/angular-cli/models/webpack-build-test.js @@ -9,9 +9,13 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { return { devtool: 'inline-source-map', - context: path.resolve(__dirname, './'), + context: path.resolve(projectRoot, appConfig.root), resolve: { - extensions: ['.ts', '.js'] + extensions: ['.ts', '.js'], + modules: [ + path.resolve(projectRoot, appConfig.root), + 'node_modules' + ] }, entry: { test: path.resolve(appRoot, appConfig.test)