1
1
// tslint:disable
2
2
// TODO: cleanup this file, it's copied as is from Angular CLI.
3
-
3
+ import { virtualFs } from '@angular-devkit/core' ;
4
+ import { Stats } from 'fs' ;
4
5
import * as path from 'path' ;
5
6
import { stripIndent } from 'common-tags' ;
6
7
import {
@@ -19,7 +20,12 @@ const webpackLoader: string = g['angularCliIsLocal']
19
20
: '@ngtools/webpack' ;
20
21
21
22
22
- function _createAotPlugin ( wco : WebpackConfigOptions , options : any , useMain = true ) {
23
+ function _createAotPlugin (
24
+ wco : WebpackConfigOptions ,
25
+ options : any ,
26
+ host : virtualFs . Host < Stats > ,
27
+ useMain = true ,
28
+ ) {
23
29
const { appConfig, root, buildOptions } = wco ;
24
30
options . compilerOptions = options . compilerOptions || { } ;
25
31
@@ -102,22 +108,23 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any, useMain = tru
102
108
additionalLazyModules,
103
109
nameLazyFiles : buildOptions . namedChunks ,
104
110
forkTypeChecker : buildOptions . forkTypeChecker ,
105
- ...options
111
+ ...options ,
112
+ host,
106
113
} ;
107
114
return new AngularCompilerPlugin ( pluginOptions ) ;
108
115
}
109
116
110
- export function getNonAotConfig ( wco : WebpackConfigOptions ) {
117
+ export function getNonAotConfig ( wco : WebpackConfigOptions , host : virtualFs . Host < Stats > ) {
111
118
const { appConfig, root } = wco ;
112
119
const tsConfigPath = path . resolve ( root , appConfig . tsConfig ) ;
113
120
114
121
return {
115
122
module : { rules : [ { test : / \. t s $ / , loader : webpackLoader } ] } ,
116
- plugins : [ _createAotPlugin ( wco , { tsConfigPath, skipCodeGeneration : true } ) ]
123
+ plugins : [ _createAotPlugin ( wco , { tsConfigPath, skipCodeGeneration : true } , host ) ]
117
124
} ;
118
125
}
119
126
120
- export function getAotConfig ( wco : WebpackConfigOptions ) {
127
+ export function getAotConfig ( wco : WebpackConfigOptions , host : virtualFs . Host < Stats > ) {
121
128
const { root, buildOptions, appConfig } = wco ;
122
129
const tsConfigPath = path . resolve ( root , appConfig . tsConfig ) ;
123
130
@@ -133,11 +140,11 @@ export function getAotConfig(wco: WebpackConfigOptions) {
133
140
134
141
return {
135
142
module : { rules : [ { test, use : loaders } ] } ,
136
- plugins : [ _createAotPlugin ( wco , { tsConfigPath } ) ]
143
+ plugins : [ _createAotPlugin ( wco , { tsConfigPath } , host ) ]
137
144
} ;
138
145
}
139
146
140
- export function getNonAotTestConfig ( wco : WebpackConfigOptions ) {
147
+ export function getNonAotTestConfig ( wco : WebpackConfigOptions , host : virtualFs . Host < Stats > ) {
141
148
const { root, appConfig } = wco ;
142
149
const tsConfigPath = path . resolve ( root , appConfig . tsConfig ) ;
143
150
@@ -152,6 +159,6 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
152
159
153
160
return {
154
161
module : { rules : [ { test : / \. t s $ / , loader : webpackLoader } ] } ,
155
- plugins : [ _createAotPlugin ( wco , pluginOptions , false ) ]
162
+ plugins : [ _createAotPlugin ( wco , pluginOptions , host , false ) ]
156
163
} ;
157
164
}
0 commit comments