Skip to content

Commit

Permalink
fix(@angular/cli): glob copy plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
jiverson authored and filipesilva committed Jun 29, 2017
1 parent acffd20 commit 405b887
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/@angular/cli/tasks/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ class JsonWebpackSerializer {
}
}

private _globCopyWebpackPluginSerialize(value: any): any {
let patterns = value.options.patterns;
let globOptions = value.options.globOptions;
return {
patterns,
globOptions: this._globReplacer(globOptions)
};
}

private _commonsChunkPluginSerialize(value: any): any {
let minChunks = value.minChunks;
switch (typeof minChunks) {
Expand Down Expand Up @@ -165,11 +174,13 @@ class JsonWebpackSerializer {
this._addImport('webpack.optimize', 'UglifyJsPlugin');
break;
case angularCliPlugins.BaseHrefWebpackPlugin:
case angularCliPlugins.GlobCopyWebpackPlugin:
case angularCliPlugins.SuppressExtractedTextChunksWebpackPlugin:
this._addImport('@angular/cli/plugins/webpack', plugin.constructor.name);
break;

case angularCliPlugins.GlobCopyWebpackPlugin:
args = this._globCopyWebpackPluginSerialize(plugin);
this._addImport('@angular/cli/plugins/webpack', 'GlobCopyWebpackPlugin');
break;
case webpack.optimize.CommonsChunkPlugin:
args = this._commonsChunkPluginSerialize(plugin);
this._addImport('webpack.optimize', 'CommonsChunkPlugin');
Expand Down Expand Up @@ -321,6 +332,12 @@ class JsonWebpackSerializer {
});
}

private _globReplacer(value: any) {
return Object.assign({}, value, {
cwd: this._relativePath('process.cwd()', path.relative(this._root, value.cwd))
});
}

private _replacer(_key: string, value: any) {
if (value === undefined) {
return value;
Expand Down

0 comments on commit 405b887

Please sign in to comment.