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
148
148
/// </summary>
149
149
/// <returns>The configuration, for chaining</returns>
150
150
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 ) ;
151
162
}
152
163
}
Original file line number Diff line number Diff line change @@ -121,8 +121,12 @@ protected virtual void InitialiseEngine(IJsEngine engine)
121
121
engine . ExecuteResource ( "React.Core.Resources.shims.js" , thisAssembly ) ;
122
122
if ( _config . LoadReact )
123
123
{
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
+ ) ;
126
130
}
127
131
128
132
LoadUserScripts ( engine ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public ReactSiteConfiguration()
42
42
{
43
43
StringEscapeHandling = StringEscapeHandling . EscapeHtml
44
44
} ;
45
+ UseDebugReact = false ;
45
46
}
46
47
47
48
/// <summary>
@@ -253,5 +254,21 @@ public IReactSiteConfiguration SetBabelConfig(BabelConfig value)
253
254
BabelConfig = value ;
254
255
return this ;
255
256
}
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
+ }
256
273
}
257
274
}
You can’t perform that action at this time.
0 commit comments