@@ -3,21 +3,20 @@ import * as CopyWebpackPlugin from 'copy-webpack-plugin';
3
3
import * as HtmlWebpackPlugin from 'html-webpack-plugin' ;
4
4
import * as webpack from 'webpack' ;
5
5
import * as atl from 'awesome-typescript-loader' ;
6
- import { CliConfig } from './config' ;
7
6
8
7
import { findLazyModules } from './find-lazy-modules' ;
9
8
10
- export function getWebpackCommonConfig ( projectRoot : string , sourceDir : string ) {
11
- const sourceRoot = path . resolve ( projectRoot , `./${ sourceDir } ` ) ;
12
9
13
- let outputPath : string = path . resolve ( projectRoot , outputDir ) ;
10
+ export function getWebpackCommonConfig ( projectRoot : string , sourceDir : string , outputDir : string ) {
11
+ const sourceRoot = path . resolve ( projectRoot , `./${ sourceDir } ` ) ;
12
+ const outputPath = path . resolve ( projectRoot , outputDir ) ;
14
13
const lazyModules = findLazyModules ( path . resolve ( projectRoot , sourceDir ) ) ;
15
14
16
15
return {
17
16
devtool : 'source-map' ,
18
17
resolve : {
19
18
extensions : [ '' , '.ts' , '.js' ] ,
20
- root : path . resolve ( projectRoot , `./ ${ sourceDir } ` )
19
+ root : sourceRoot
21
20
} ,
22
21
context : path . resolve ( __dirname , './' ) ,
23
22
entry : {
@@ -37,7 +36,7 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
37
36
loader : 'awesome-typescript-loader' ,
38
37
query : {
39
38
useForkChecker : true ,
40
- tsconfig : path . resolve ( projectRoot , `./ ${ sourceDir } / tsconfig.json` )
39
+ tsconfig : path . resolve ( sourceRoot , `tsconfig.json` )
41
40
}
42
41
} , {
43
42
loader : 'angular2-template-loader'
@@ -58,7 +57,7 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
58
57
new webpack . ContextReplacementPlugin ( / .* / , sourceRoot , lazyModules ) ,
59
58
new atl . ForkCheckerPlugin ( ) ,
60
59
new HtmlWebpackPlugin ( {
61
- template : path . resolve ( projectRoot , `./ ${ sourceDir } /index.html` ) ,
60
+ template : path . resolve ( sourceDir , `/index.html` ) ,
62
61
chunksSortMode : 'dependency'
63
62
} ) ,
64
63
new webpack . optimize . CommonsChunkPlugin ( {
0 commit comments