File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -148,5 +148,16 @@ public interface IReactSiteConfiguration
148148 /// </summary>
149149 /// <returns>The configuration, for chaining</returns>
150150 IReactSiteConfiguration SetBabelConfig ( BabelConfig value ) ;
151+
152+ /// <summary>
153+ /// Gets or sets whether to use the debug version of React. This is slower, but gives
154+ /// useful debugging tips.
155+ /// </summary>
156+ bool UseDebugReact { get ; set ; }
157+ /// <summary>
158+ /// Sets whether to use the debug version of React. This is slower, but gives
159+ /// useful debugging tips.
160+ /// </summary>
161+ IReactSiteConfiguration SetUseDebugReact ( bool value ) ;
151162 }
152163}
Original file line number Diff line number Diff line change @@ -121,8 +121,12 @@ protected virtual void InitialiseEngine(IJsEngine engine)
121121 engine . ExecuteResource ( "React.Core.Resources.shims.js" , thisAssembly ) ;
122122 if ( _config . LoadReact )
123123 {
124- // TODO: Add option to choose whether to load dev vs prod version of React.
125- engine . ExecuteResource ( "React.Core.Resources.react.generated.js" , thisAssembly ) ;
124+ engine . ExecuteResource (
125+ _config . UseDebugReact
126+ ? "React.Core.Resources.react.generated.js"
127+ : "React.Core.Resources.react.generated.min.js" ,
128+ thisAssembly
129+ ) ;
126130 }
127131
128132 LoadUserScripts ( engine ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public ReactSiteConfiguration()
4242 {
4343 StringEscapeHandling = StringEscapeHandling . EscapeHtml
4444 } ;
45+ UseDebugReact = false ;
4546 }
4647
4748 /// <summary>
@@ -253,5 +254,21 @@ public IReactSiteConfiguration SetBabelConfig(BabelConfig value)
253254 BabelConfig = value ;
254255 return this ;
255256 }
257+
258+ /// <summary>
259+ /// Gets or sets whether to use the debug version of React. This is slower, but gives
260+ /// useful debugging tips.
261+ /// </summary>
262+ public bool UseDebugReact { get ; set ; }
263+
264+ /// <summary>
265+ /// Sets whether to use the debug version of React. This is slower, but gives
266+ /// useful debugging tips.
267+ /// </summary>
268+ public IReactSiteConfiguration SetUseDebugReact ( bool value )
269+ {
270+ UseDebugReact = value ;
271+ return this ;
272+ }
256273 }
257274}
You can’t perform that action at this time.
0 commit comments