Skip to content

Commit 0bda2c6

Browse files
committed
Expose ReactDOM just in case it's used in some script. Closes #186
1 parent 2846b10 commit 0bda2c6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/React.Core/JavaScriptEngineFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ protected virtual void InitialiseEngine(IJsEngine engine)
108108
{
109109
engine.ExecuteResource("React.Resources.react-with-addons.js", thisAssembly);
110110
engine.Execute("React = global.React");
111+
// Expose ReactDOM as some scripts may be using it. #yolo
112+
engine.Execute("ReactDOM = React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED");
111113
}
112114

113115
LoadUserScripts(engine);

src/React.Core/Resources/shims.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
var global = global || {};
1111
var React;
12+
var ReactDOM;
1213

1314
// Basic console shim. Caches all calls to console methods.
1415
function MockConsole() {
@@ -58,11 +59,13 @@ function ReactNET_initReact() {
5859
}
5960
if (global.React) {
6061
React = global.React;
62+
ReactDOM = React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // YOLO
6163
return true;
6264
}
6365
if (typeof require === 'function') {
6466
// CommonJS-like environment (eg. Browserify)
6567
React = require('react');
68+
ReactDOM = React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // YOLO
6669
return true;
6770
}
6871
// :'(

0 commit comments

Comments
 (0)