mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Proxy ReactDOM for plugins (#1878)
* Proxy ReactDOM for plugins * Update Module._load comment
This commit is contained in:
parent
0d63360011
commit
af43bbbfed
1 changed files with 6 additions and 1 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
import {connect as reduxConnect} from 'react-redux';
|
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 React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
import Component from '../component';
|
import Component from '../component';
|
||||||
import Notification from '../components/notification';
|
import Notification from '../components/notification';
|
||||||
import notify from './notify';
|
import notify from './notify';
|
||||||
|
|
@ -13,6 +16,8 @@ Module._load = function (path) {
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case 'react':
|
case 'react':
|
||||||
return React;
|
return React;
|
||||||
|
case 'react-dom':
|
||||||
|
return ReactDOM;
|
||||||
case 'hyper/component':
|
case 'hyper/component':
|
||||||
return Component;
|
return Component;
|
||||||
case 'hyper/notify':
|
case 'hyper/notify':
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue