Skip to content

Commit d5b703c

Browse files
filipesilvajohannes.werner
authored and
johannes.werner
committed
fix(build): re-add support for sourceDir (angular#1378)
1 parent 391938f commit d5b703c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

addon/ng2/models/webpack-build-test.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import * as webpack from 'webpack';
2+
import { CliConfig } from './config';
23

34
const path = require('path');
45

5-
export const getWebpackTestConfig = function(projectRoot: string) {
6+
export const getWebpackTestConfig = function(projectRoot: string, sourceDir: string) {
67
return {
78
devtool: 'inline-source-map',
89
context: path.resolve(__dirname, './'),
910
resolve: {
1011
extensions: ['', '.ts', '.js'],
11-
root: path.resolve(projectRoot, './src')
12+
root: path.resolve(projectRoot, `./${sourceDir}`)
1213
},
1314
entry: {
14-
test: path.resolve(projectRoot, './src/test.ts')
15+
test: path.resolve(projectRoot, `./${sourceDir}/test.ts`)
1516
},
1617
output: {
1718
path: './dist.test',
@@ -43,7 +44,7 @@ export const getWebpackTestConfig = function(projectRoot: string) {
4344
loader: 'awesome-typescript-loader',
4445
query: {
4546
useWebpackText: true,
46-
tsconfig: path.resolve(projectRoot, './src/tsconfig.json'),
47+
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`),
4748
module: "commonjs",
4849
target: "es5",
4950
useForkChecker: true,
@@ -62,7 +63,7 @@ export const getWebpackTestConfig = function(projectRoot: string) {
6263
{ test: /\.less$/, loaders: ['raw-loader', 'postcss-loader', 'less-loader'] },
6364
{ test: /\.scss$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] },
6465
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000'},
65-
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(projectRoot, 'src/index.html')] }
66+
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(projectRoot, `./${sourceDir}/index.html`)] }
6667
],
6768
postLoaders: [
6869
{
@@ -77,7 +78,7 @@ export const getWebpackTestConfig = function(projectRoot: string) {
7778
tslint: {
7879
emitErrors: false,
7980
failOnHint: false,
80-
resourcePath: 'src'
81+
resourcePath: `./${sourceDir}`
8182
},
8283
node: {
8384
global: 'window',

addon/ng2/tasks/test.js

Whitespace-only changes.

0 commit comments

Comments
 (0)