mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 10:08:57 +00:00
adding support to pass Env param to webpack
This commit is contained in:
committed by
Steve Sanderson
parent
e7ffb8bb71
commit
7c07beb494
@@ -50,5 +50,10 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
|
|||||||
/// the webpack compiler.
|
/// the webpack compiler.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDictionary<string, string> EnvironmentVariables { get; set; }
|
public IDictionary<string, string> EnvironmentVariables { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pass in the env parameter to webpack.
|
||||||
|
/// </summary>
|
||||||
|
public object EnvParam { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ interface DevServerOptions {
|
|||||||
HotModuleReplacementServerPort: number;
|
HotModuleReplacementServerPort: number;
|
||||||
HotModuleReplacementClientOptions: StringMap<string>;
|
HotModuleReplacementClientOptions: StringMap<string>;
|
||||||
ReactHotModuleReplacement: boolean;
|
ReactHotModuleReplacement: boolean;
|
||||||
|
EnvParam: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We support these three kinds of webpack.config.js export. We don't currently support exported promises
|
// We support these three kinds of webpack.config.js export. We don't currently support exported promises
|
||||||
@@ -248,7 +249,7 @@ export function createWebpackDevServer(callback: CreateDevServerCallback, option
|
|||||||
// In the future, we could add support for configuring the 'env' param in Startup.cs. But right
|
// In the future, we could add support for configuring the 'env' param in Startup.cs. But right
|
||||||
// now, it's not clear that people will want to do that (and they can always make up their own
|
// now, it's not clear that people will want to do that (and they can always make up their own
|
||||||
// default env values in their webpack.config.js).
|
// default env values in their webpack.config.js).
|
||||||
webpackConfigExport = webpackConfigExport();
|
webpackConfigExport = webpackConfigExport(options.suppliedOptions.EnvParam);
|
||||||
}
|
}
|
||||||
const webpackConfigArray = webpackConfigExport instanceof Array ? webpackConfigExport : [webpackConfigExport];
|
const webpackConfigArray = webpackConfigExport instanceof Array ? webpackConfigExport : [webpackConfigExport];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user