Skip to content

Commit 2cba72a

Browse files
committed
Fix code after rebase master
1 parent 009d277 commit 2cba72a

File tree

2 files changed

+28
-33
lines changed

2 files changed

+28
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
1+
import * as path from 'path';
2+
13
import {CliConfig} from './config';
24
import {NgCliWebpackConfig} from './webpack-config';
35
const webpackMerge = require('webpack-merge');
46
import {getWebpackExtractI18nConfig} from './webpack-extract-i18n';
57

8+
export interface XI18WebpackOptions {
9+
genDir?: string,
10+
buildDir?: string,
11+
i18nFormat?: string,
12+
verbose?: boolean,
13+
progress?: boolean
14+
}
615
export class XI18nWebpackConfig extends NgCliWebpackConfig {
716

817
public config: any;
918

10-
constructor(
11-
ngCliProject: any,
12-
genDir: string,
13-
buildDir: string,
14-
i18nFormat: string,
15-
verbose: boolean = false, progress: boolean = true) {
16-
super(
17-
ngCliProject,
18-
'development',
19-
'dev',
20-
buildDir,
21-
null,
22-
null,
23-
null,
24-
null,
25-
false,
26-
true,
27-
true,
28-
verbose,
29-
progress,
30-
null,
31-
'none',
32-
true);
19+
constructor(extractOptions: XI18WebpackOptions) {
20+
21+
super({
22+
target: 'development',
23+
verbose: extractOptions.verbose,
24+
progress: extractOptions.progress
25+
});
3326

27+
const configPath = CliConfig.configFilePath();
28+
const projectRoot = path.dirname(configPath);
3429
const appConfig = CliConfig.fromProject().config.apps[0];
3530

36-
let config = this.config;
3731
const extractI18nConfig =
38-
getWebpackExtractI18nConfig(this.ngCliProject.root, appConfig, genDir, i18nFormat);
39-
config = webpackMerge(config, extractI18nConfig);
32+
getWebpackExtractI18nConfig(projectRoot,
33+
appConfig,
34+
extractOptions.genDir,
35+
extractOptions.i18nFormat);
4036

41-
this.config = config;
37+
this.config = webpackMerge([this.config, extractI18nConfig]);
4238
}
4339
}

packages/angular-cli/tasks/extract-i18n.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ export const Extracti18nTask = Task.extend({
1818
const buildDir = '.tmp';
1919
const genDir = runTaskOptions.outputPath || appConfig.root;
2020

21-
const config = new XI18nWebpackConfig(
22-
project,
21+
const config = new XI18nWebpackConfig({
2322
genDir,
2423
buildDir,
25-
runTaskOptions.i18nFormat,
26-
runTaskOptions.verbose,
27-
runTaskOptions.progress
28-
).config;
24+
i18nFormat: runTaskOptions.i18nFormat,
25+
verbose: runTaskOptions.verbose,
26+
progress: runTaskOptions.progress
27+
}).config;
2928

3029
const webpackCompiler = webpack(config);
3130
//const statsConfig = getWebpackStatsConfig(runTaskOptions.verbose);

0 commit comments

Comments
 (0)