1- /*
1+ /*
22 * Copyright (c) Facebook, Inc. and its affiliates.
33 *
44 * This source code is licensed under the MIT license found in the
@@ -35,11 +35,13 @@ public static class ReactBuilderExtensions
3535 /// <param name="app">ASP.NET application builder</param>
3636 /// <param name="configure">ReactJS.NET configuration</param>
3737 /// <param name="fileOptions">Options to use for serving files</param>
38+ /// <param name="useNodeEnvironment"></param>
3839 /// <returns>The application builder (for chaining)</returns>
3940 public static IApplicationBuilder UseReact (
4041 this IApplicationBuilder app ,
4142 Action < IReactSiteConfiguration > configure ,
42- BabelFileOptions fileOptions = null
43+ BabelFileOptions fileOptions = null ,
44+ bool useNodeEnvironment = false
4345 )
4446 {
4547 RegisterAspNetServices ( React . AssemblyRegistration . Container , app . ApplicationServices ) ;
@@ -55,6 +57,12 @@ public static IApplicationBuilder UseReact(
5557
5658 configure ( ReactSiteConfiguration . Configuration ) ;
5759
60+ if ( useNodeEnvironment )
61+ {
62+ TinyIoCContainer . Current . Unregister < IReactEnvironment > ( ) ;
63+ TinyIoCContainer . Current . Register < IReactEnvironment , ReactWithNodeEnvironment > ( ) ;
64+ }
65+
5866 // Allow serving of .jsx files
5967 app . UseMiddleware < BabelFileMiddleware > ( fileOptions ?? new BabelFileOptions ( ) ) ;
6068
0 commit comments