Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c07beb

Browse filesBrowse files
Jordan McDonaldSteveSandersonMS
authored andcommitted
adding support to pass Env param to webpack
1 parent e7ffb8b commit 7c07beb
Copy full SHA for 7c07beb

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Open diff view settings
Collapse file

‎src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs‎

Copy file name to clipboardExpand all lines: src/Microsoft.AspNetCore.SpaServices/Webpack/WebpackDevMiddlewareOptions.cs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,10 @@ public class WebpackDevMiddlewareOptions
5050
/// the webpack compiler.
5151
/// </summary>
5252
public IDictionary<string, string> EnvironmentVariables { get; set; }
53+
54+
/// <summary>
55+
/// Pass in the env parameter to webpack.
56+
/// </summary>
57+
public object EnvParam { get; set; }
5358
}
5459
}
Collapse file

‎src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts‎

Copy file name to clipboardExpand all lines: src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ interface DevServerOptions {
3232
HotModuleReplacementServerPort: number;
3333
HotModuleReplacementClientOptions: StringMap<string>;
3434
ReactHotModuleReplacement: boolean;
35+
EnvParam: any;
3536
}
3637

3738
// 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
248249
// In the future, we could add support for configuring the 'env' param in Startup.cs. But right
249250
// now, it's not clear that people will want to do that (and they can always make up their own
250251
// default env values in their webpack.config.js).
251-
webpackConfigExport = webpackConfigExport();
252+
webpackConfigExport = webpackConfigExport(options.suppliedOptions.EnvParam);
252253
}
253254
const webpackConfigArray = webpackConfigExport instanceof Array ? webpackConfigExport : [webpackConfigExport];
254255

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.