@@ -43,34 +43,39 @@ class AdvancedGroup extends GroupHelper {
4343 // }
4444 // }
4545 resolveOptions ( ) {
46- const { args } = this ;
46+ const {
47+ args,
48+ opts : { options } ,
49+ } = this ;
50+
4751 if ( args . hot ) {
4852 const { HotModuleReplacementPlugin } = require ( 'webpack' ) ;
4953 const hotModuleVal = new HotModuleReplacementPlugin ( ) ;
50- if ( this . opts . options && this . opts . options . plugins ) {
51- this . opts . options . plugins . unshift ( hotModuleVal ) ;
54+ if ( options && options . plugins ) {
55+ options . plugins . unshift ( hotModuleVal ) ;
5256 } else {
53- this . opts . options . plugins = [ hotModuleVal ] ;
57+ options . plugins = [ hotModuleVal ] ;
5458 }
5559 }
5660 if ( args . prefetch ) {
5761 const { PrefetchPlugin } = require ( 'webpack' ) ;
5862 const prefetchVal = new PrefetchPlugin ( null , args . prefetch ) ;
59- if ( this . opts . options && this . opts . options . plugins ) {
60- this . opts . options . plugins . unshift ( prefetchVal ) ;
63+ if ( options && options . plugins ) {
64+ options . plugins . unshift ( prefetchVal ) ;
6165 } else {
62- this . opts . options . plugins = [ prefetchVal ] ;
66+ // Currently the Plugin function is not functional -> https://github.com/webpack/webpack-cli/pull/1140#discussion_r376761359
67+ // options.plugins = [prefetchVal];
6368 }
6469 }
6570 if ( args . plugin ) {
66- if ( this . opts . options && this . opts . options . plugins ) {
67- this . opts . options . plugins . unshift ( this . loadPlugin ( args . plugin ) ) ;
71+ if ( options && options . plugins ) {
72+ options . plugins . unshift ( this . loadPlugin ( args . plugin ) ) ;
6873 } else {
69- this . opts . options . plugins = [ this . loadPlugin ( args . plugin ) ] ;
74+ options . plugins = [ this . loadPlugin ( args . plugin ) ] ;
7075 }
7176 }
7277 if ( args . target ) {
73- this . opts . options . target = args . target ;
78+ options . target = args . target ;
7479 }
7580
7681 if ( args . global ) {
@@ -119,10 +124,10 @@ class AdvancedGroup extends GroupHelper {
119124
120125 const { ProvidePlugin } = require ( 'webpack' ) ;
121126 const globalVal = new ProvidePlugin ( providePluginObject ) ;
122- if ( this . opts . options && this . opts . options . plugins ) {
123- this . opts . options . plugins . unshift ( globalVal ) ;
127+ if ( options && options . plugins ) {
128+ options . plugins . unshift ( globalVal ) ;
124129 } else {
125- this . opts . options . plugins = [ globalVal ] ;
130+ options . plugins = [ globalVal ] ;
126131 }
127132 }
128133 }
0 commit comments