Skip to content

Commit 32bae6d

Browse files
alan-agius4Keen Yee Liau
authored and
Keen Yee Liau
committed
refactor: small refactor in AOT plugin file
1 parent 4024e8a commit 32bae6d

File tree

1 file changed

+6
-7
lines changed
  • packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs

1 file changed

+6
-7
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/typescript.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,16 @@ function _pluginOptionsOverrides(
4949

5050
function _createAotPlugin(
5151
wco: WebpackConfigOptions,
52-
options: any,
53-
useMain = true,
54-
extract = false,
52+
options: AngularCompilerPluginOptions,
53+
i18nExtract = false,
5554
) {
5655
const { root, buildOptions } = wco;
5756

5857
const i18nInFile = buildOptions.i18nFile
5958
? path.resolve(root, buildOptions.i18nFile)
6059
: undefined;
6160

62-
const i18nFileAndFormat = extract
61+
const i18nFileAndFormat = i18nExtract
6362
? {
6463
i18nOutFile: buildOptions.i18nFile,
6564
i18nOutFormat: buildOptions.i18nFormat,
@@ -79,7 +78,7 @@ function _createAotPlugin(
7978
}
8079

8180
let pluginOptions: AngularCompilerPluginOptions = {
82-
mainPath: useMain ? path.join(root, buildOptions.main) : undefined,
81+
mainPath: path.join(root, buildOptions.main),
8382
...i18nFileAndFormat,
8483
locale: buildOptions.i18nLocale,
8584
platform: buildOptions.platform === 'server' ? PLATFORM.Server : PLATFORM.Browser,
@@ -108,7 +107,7 @@ export function getNonAotConfig(wco: WebpackConfigOptions) {
108107
};
109108
}
110109

111-
export function getAotConfig(wco: WebpackConfigOptions, extract = false) {
110+
export function getAotConfig(wco: WebpackConfigOptions, i18nExtract = false) {
112111
const { tsConfigPath, buildOptions } = wco;
113112

114113
const loaders: any[] = [NgToolsLoader];
@@ -123,7 +122,7 @@ export function getAotConfig(wco: WebpackConfigOptions, extract = false) {
123122

124123
return {
125124
module: { rules: [{ test, use: loaders }] },
126-
plugins: [_createAotPlugin(wco, { tsConfigPath }, true, extract)]
125+
plugins: [_createAotPlugin(wco, { tsConfigPath }, i18nExtract)]
127126
};
128127
}
129128

0 commit comments

Comments
 (0)