@@ -30,11 +30,11 @@ public WebPackMiddlewareOptions Execute(WebpackOptions options) {
3030 EnsuereNodeModluesInstalled ( options . EnableHotLoading , logger ) ;
3131 logger . LogInformation ( $ "All node modules are properly installed") ;
3232
33- CreateWebpackConfigurationFile ( options ) ;
33+ var includeDefaultConfigFile = CreateWebpackConfigurationFile ( options ) ;
3434
3535 logger . LogInformation ( $ "{ toolToExecute } Execution started") ;
3636 try {
37- var arguments = ArgumentsHelper . GetWebpackArguments ( _webRootPath , options ) ;
37+ var arguments = ArgumentsHelper . GetWebpackArguments ( _webRootPath , options , includeDefaultConfigFile ) ;
3838 logger . LogInformation ( $ "{ toolToExecute } is called with these arguments: { arguments } ") ;
3939 Process process = new Process ( ) ;
4040 process . StartInfo = new ProcessStartInfo ( ) {
@@ -109,10 +109,7 @@ private static string GetNodeExecutable(string module) {
109109 return executable ;
110110 }
111111
112- private static void CreateWebpackConfigurationFile ( WebpackOptions options ) {
113- if ( ! Directory . Exists ( "webpack" ) ) {
114- Directory . CreateDirectory ( "webpack" ) ;
115- }
112+ private static bool CreateWebpackConfigurationFile ( WebpackOptions options ) {
116113 var presets = new List < string > ( ) {
117114 "es2015"
118115 } ;
@@ -146,6 +143,9 @@ private static void CreateWebpackConfigurationFile(WebpackOptions options) {
146143 } ;
147144 // Create the external configuration file only if we need to use babel-loader
148145 if ( loaders . Count > 0 ) {
146+ if ( ! Directory . Exists ( "webpack" ) ) {
147+ Directory . CreateDirectory ( "webpack" ) ;
148+ }
149149 var jsonResult = JsonConvert . SerializeObject ( exports ,
150150 new JsonSerializerSettings {
151151 Formatting = Formatting . Indented ,
@@ -157,7 +157,9 @@ private static void CreateWebpackConfigurationFile(WebpackOptions options) {
157157 streamWriter . WriteLine ( fileContent ) ;
158158 }
159159 }
160+ return true ;
160161 }
162+ return false ;
161163 }
162164
163165 }
0 commit comments