From af43bbbfed9867a1f37a13fdda48d73e3ccfb449 Mon Sep 17 00:00:00 2001 From: Albin Ekblom Date: Sat, 27 May 2017 21:37:41 +0200 Subject: [PATCH] Proxy ReactDOM for plugins (#1878) * Proxy ReactDOM for plugins * Update Module._load comment --- lib/utils/plugins.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils/plugins.js b/lib/utils/plugins.js index 14c82b33..f7016ac3 100644 --- a/lib/utils/plugins.js +++ b/lib/utils/plugins.js @@ -1,8 +1,11 @@ import {remote} from 'electron'; import {connect as reduxConnect} from 'react-redux'; -// we expose these two deps to component decorators +// patching Module._load +// so plugins can `require` them wihtout needing their own version +// https://github.com/zeit/hyper/issues/619 import React from 'react'; +import ReactDOM from 'react-dom'; import Component from '../component'; import Notification from '../components/notification'; import notify from './notify'; @@ -13,6 +16,8 @@ Module._load = function (path) { switch (path) { case 'react': return React; + case 'react-dom': + return ReactDOM; case 'hyper/component': return Component; case 'hyper/notify':