mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Replace webpack and Module Federation with Vite 8. The controller build emits one entry per shared module (lib, web_ui, typebox, antd, react, react-dom, react-router) and lists them in manifest.json. The controller turns that into an import map in index.html, and plugins are built as ES modules that import the shared modules by name and are loaded with import(). The shared Vite setup lives in @clusterio/web_ui/vite.mjs. Plugins use clusterioPlugin(), which exposes index, package.json and web/index under the same keys the webpack template used. The --dev and --dev-plugin flags now run the Vite dev server in middleware mode with hot module replacement. Browser polyfills move from web_ui to lib, which is the code that needs them, and lib sets the process and Buffer globals itself. Refs #1127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.4 KiB
HTML
50 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="theme-color" content="#2a2a2a" />
|
|
<title>__CLUSTER_NAME__</title>
|
|
<script type="importmap">__IMPORT_MAP__</script>
|
|
<style>
|
|
html {
|
|
color: #fff;
|
|
background-color: #000;
|
|
}
|
|
|
|
#bootstrap-msg {
|
|
font: 20px serif;
|
|
color: #aaa;
|
|
margin: auto;
|
|
margin-top: 1em;
|
|
width: fit-content;
|
|
white-space: pre;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
<div id="root">
|
|
<div id="bootstrap-msg">Loading web interface...</div>
|
|
</div>
|
|
<script>
|
|
webRoot = new URL("__WEB_ROOT__", document.location).pathname;
|
|
staticRoot = new URL("__STATIC_ROOT__", document.location).href;
|
|
function scriptError(err) {
|
|
console.error(err);
|
|
let bootstrapMsg = document.getElementById("bootstrap-msg");
|
|
if (bootstrapMsg) {
|
|
let errorMsg = err;
|
|
if (err?.message) {
|
|
errorMsg = `${err?.constructor?.name ?? "Error"}: ${err.message}`;
|
|
}
|
|
bootstrapMsg.textContent = `${errorMsg}\nSee web console for details.`;
|
|
}
|
|
}
|
|
window.addEventListener("error", event => scriptError(event.error));
|
|
</script>
|
|
<script id="script-bundle" type="module" src="__STATIC_ROOT____MAIN_BUNDLE__"
|
|
onerror="scriptError('Main bundle failed to load.')"></script>
|
|
</body>
|
|
</html>
|