This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree 1 file changed +6
-3
lines changed
src/Microsoft.AspNetCore.SpaServices/Webpack
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ public static void UseWebpackDevMiddleware(
42
42
// as fast as some theoretical future alternative.
43
43
var nodeServicesOptions = new NodeServicesOptions ( appBuilder . ApplicationServices ) ;
44
44
nodeServicesOptions . WatchFileExtensions = new string [ ] { } ; // Don't watch anything
45
+ if ( ! string . IsNullOrEmpty ( options . ProjectPath ) )
46
+ {
47
+ nodeServicesOptions . ProjectPath = options . ProjectPath ;
48
+ }
49
+
45
50
var nodeServices = NodeServicesFactory . CreateNodeServices ( nodeServicesOptions ) ;
46
51
47
52
// Get a filename matching the middleware Node script
@@ -50,11 +55,9 @@ public static void UseWebpackDevMiddleware(
50
55
var nodeScript = new StringAsTempFile ( script ) ; // Will be cleaned up on process exit
51
56
52
57
// Tell Node to start the server hosting webpack-dev-middleware
53
- var hostEnv = ( IHostingEnvironment ) appBuilder . ApplicationServices . GetService ( typeof ( IHostingEnvironment ) ) ;
54
- var projectPath = options . ProjectPath ?? hostEnv . ContentRootPath ;
55
58
var devServerOptions = new
56
59
{
57
- webpackConfigPath = Path . Combine ( projectPath , options . ConfigFile ?? DefaultConfigFile ) ,
60
+ webpackConfigPath = Path . Combine ( nodeServicesOptions . ProjectPath , options . ConfigFile ?? DefaultConfigFile ) ,
58
61
suppliedOptions = options
59
62
} ;
60
63
var devServerInfo =
You can’t perform that action at this time.
0 commit comments