@@ -9,13 +9,7 @@ import {findLazyModules} from './find-lazy-modules';
9
9
10
10
export function getWebpackCommonConfig ( projectRoot : string , sourceDir : string ) {
11
11
const sourceRoot = path . resolve ( projectRoot , `./${ sourceDir } ` ) ;
12
-
13
12
const lazyModules = findLazyModules ( path . resolve ( projectRoot , sourceDir ) ) ;
14
- const entries = Object . assign ( {
15
- main : [ path . join ( sourceRoot , 'main.ts' ) ] ,
16
- polyfills : path . join ( sourceRoot , 'polyfills.ts' )
17
- } , lazyModules ) ;
18
-
19
13
20
14
return {
21
15
devtool : 'source-map' ,
@@ -24,7 +18,10 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
24
18
root : path . resolve ( projectRoot , `./${ sourceDir } ` )
25
19
} ,
26
20
context : path . resolve ( __dirname , './' ) ,
27
- entry : entries ,
21
+ entry : {
22
+ main : [ path . join ( sourceRoot , 'main.ts' ) ] ,
23
+ polyfills : path . join ( sourceRoot , 'polyfills.ts' )
24
+ } ,
28
25
output : {
29
26
path : path . resolve ( projectRoot , './dist' ) ,
30
27
filename : '[name].bundle.js'
@@ -75,6 +72,7 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
75
72
]
76
73
} ,
77
74
plugins : [
75
+ new webpack . ContextReplacementPlugin ( / .* / , sourceRoot , lazyModules ) ,
78
76
new atl . ForkCheckerPlugin ( ) ,
79
77
new HtmlWebpackPlugin ( {
80
78
template : path . resolve ( projectRoot , `./${ sourceDir } /index.html` ) ,
0 commit comments