diff --git a/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs b/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs index 3825c28..9ea3299 100644 --- a/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs +++ b/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddleware.cs @@ -47,6 +47,14 @@ namespace Microsoft.AspNetCore.Builder nodeServicesOptions.ProjectPath = options.ProjectPath; } + if (options.EnvironmentVariables != null) + { + foreach (var kvp in options.EnvironmentVariables) + { + nodeServicesOptions.EnvironmentVariables[kvp.Key] = kvp.Value; + } + } + var nodeServices = NodeServicesFactory.CreateNodeServices(nodeServicesOptions); // Get a filename matching the middleware Node script diff --git a/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs b/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs index ebfe36d..8f5e12a 100644 --- a/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs +++ b/src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Microsoft.AspNetCore.SpaServices.Webpack { public class WebpackDevMiddlewareOptions @@ -7,5 +9,6 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack public bool ReactHotModuleReplacement { get; set; } public string ConfigFile { get; set; } public string ProjectPath { get; set; } + public IDictionary EnvironmentVariables { get; set; } } } \ No newline at end of file