mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Export web_ui as a single module
Due to the way the imports and exports works with module fedderation each require path needs it's own shared module in the plugin. To avoid having to specify every possible import in the module federation plugin config, export all useful components to plugins in the browser entrypoint for web_ui. Note that for some reason the module wouldn't exist for import by plugins unless some part of the build imported it. Which is the reason for the master index.jsx to import bootstrap via it.
This commit is contained in:
1 parent
a904a8fb9d
commit
579f6421e4
5 files changed
+25
-5
No files matched your search
@@ -1 +1,3 @@
|
||||
import("@clusterio/web_ui/src/bootstrap");
|
||||
import("@clusterio/web_ui").then(webUi => {
|
||||
return webUi.bootstrap();
|
||||
}).catch(console.error);
|
||||
@@ -29,7 +29,6 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
"@clusterio/lib/schema": { singleton: true },
|
||||
"@clusterio/lib/users": { singleton: true },
|
||||
"@clusterio/web_ui": { singleton: true },
|
||||
"ajv": {},
|
||||
"antd": { singleton: true },
|
||||
"react": { singleton: true },
|
||||
"react-dom": { singleton: true },
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"author": "Hornwitser",
|
||||
"license": "MIT",
|
||||
"version": "2.0.0-alpha.4",
|
||||
"browser": "src/index.jsx",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
||||
@@ -74,7 +74,7 @@ async function loadPlugins() {
|
||||
return plugins;
|
||||
}
|
||||
|
||||
async function load() {
|
||||
export default async function bootstrap() {
|
||||
logger.add(new ConsoleTransport({
|
||||
level: "verbose",
|
||||
format: new WebConsoleFormat(),
|
||||
@@ -92,5 +92,3 @@ async function load() {
|
||||
|
||||
ReactDOM.render(<App control={control} plugins={plugins}/>, document.getElementById("root"));
|
||||
}
|
||||
|
||||
load().catch((err) => logger.fatal(err.stack));
|
||||
@@ -0,0 +1,20 @@
|
||||
export { default as basename } from "./basename.jsx";
|
||||
export { default as bootstrap } from "./bootstrap.jsx";
|
||||
export { default as notify, notifyErrorHandler } from "./util/notify.jsx";
|
||||
|
||||
export * from "./model/instance.jsx";
|
||||
export * from "./model/slave.jsx";
|
||||
|
||||
|
||||
export { default as ControlContext } from "./components/ControlContext";
|
||||
export { default as PluginsContext } from "./components/PluginsContext";
|
||||
|
||||
export { default as BaseConfigTree } from "./components/BaseConfigTree";
|
||||
export { default as InstanceConfigTree } from "./components/InstanceConfigTree";
|
||||
export { default as MasterConfigTree } from "./components/MasterConfigTree";
|
||||
|
||||
export { default as AssignInstanceModal } from "./components/AssignInstanceModal";
|
||||
export { default as InstanceConsole } from "./components/InstanceConsole";
|
||||
export { default as InstanceRcon } from "./components/InstanceRcon";
|
||||
|
||||
export { default as PageLayout } from "./components/PageLayout";
|
||||
Reference in new issue
Block a user