mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
Working plugin importer
This commit is contained in:
@@ -2,8 +2,5 @@
|
||||
"extends": "../.babelrc",
|
||||
"plugins": [
|
||||
"transform-async-to-generator",
|
||||
"syntax-dynamic-import",
|
||||
"transform-regenerator",
|
||||
"transform-runtime"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import React from 'react';
|
||||
import * as Plugins from 'plugins';
|
||||
import injectedPlugins from 'coral-framework/helpers/importer';
|
||||
|
||||
export default () => <div>{Object.keys(Plugins).map((component, i) => Plugins[component]({key: i}))}</div>;
|
||||
export default function pluginContainer () {
|
||||
return (
|
||||
<div>
|
||||
{Object.keys(injectedPlugins).map((component, i) => injectedPlugins[component]({key: i}))}
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
function importer () {
|
||||
const context = require.context("../../../plugins", true, /\.\/(.*)\/client\/index.js$/);
|
||||
let res = {};
|
||||
|
||||
context.keys().forEach(function (key) {
|
||||
res[key] = context(key)
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export default importer();
|
||||
Reference in New Issue
Block a user