Drop build tool names from the controller and static_url docs

Controller.viteServer becomes devServer, matching the devMiddleware
name it replaced. The static_url limitation is described as one of the
web build rather than webpack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-27 23:01:12 +00:00
1 parent 5c92a44e65
commit bf847b8c74
4 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -103,7 +103,7 @@ Defaults to null meaning assume localhost.
Used to override where static assets such as the web bundle is loaded from.
This can be used if you want to put the static assets on a separate cdn url like `https://cdn.example.com/static/` while keeping the API hosted directly by clusterio.
Due to a limitation on how the webpack assets are built the pathname component of the url have to be `/static/`, values with any other path are rejected.
Due to a limitation on how the web assets are built the pathname component of the url have to be `/static/`, values with any other path are rejected.
See also the `clusteriocontroller copy-static` command for how to obtain the static asset files that need to be hosted.
+10 -10
View File
@@ -106,7 +106,7 @@ export default class Controller {
_registeredEvents = new Map<lib.EventClass<unknown>, lib.EventHandler<unknown>>();
_snoopedEvents = new Map();
viteServer: import("vite").ViteDevServer | null = null;
devServer: import("vite").ViteDevServer | null = null;
startedAtMs = Date.now();
autosaveInterval?: ReturnType<typeof setInterval>;
@@ -416,8 +416,8 @@ export default class Controller {
}
Controller.addAppRoutes(this.app, this.pluginInfos);
if (this.viteServer) {
this.app.use(this.viteServer.middlewares);
if (this.devServer) {
this.app.use(this.devServer.middlewares);
}
if (!args.dev) {
@@ -516,7 +516,7 @@ export default class Controller {
this.app.locals.devPlugins = devPlugins;
const controllerDir = path.join(import.meta.dirname, "..", "..", "..");
this.viteServer = await vite.createServer({
this.devServer = await vite.createServer({
configFile: path.join(controllerDir, "vite.config.js"),
root: controllerDir,
base: "/static/",
@@ -529,13 +529,13 @@ export default class Controller {
});
if (args.dev) {
this.app.locals.webBundle = {
main: this.viteServer.config.plugins.find(p => p.name === "clusterio:app")!.api.entry,
main: this.devServer.config.plugins.find(p => p.name === "clusterio:app")!.api.entry,
imports: Object.fromEntries(webUiVite.sharedModules.map(
name => [name, webUiVite.devSharedUrl(name)]
)),
};
}
this.app.locals.viteServer = this.viteServer;
this.app.locals.devServer = this.devServer;
}
/**
@@ -586,8 +586,8 @@ export default class Controller {
await this.clusterLogIndex.save();
}
if (this.viteServer) {
await this.viteServer.close();
if (this.devServer) {
await this.devServer.close();
}
await this.hooks.shutdown.invoke();
@@ -1388,8 +1388,8 @@ export default class Controller {
.replace(/__IMPORT_MAP__/g, () => importMap)
.replace(/__MAIN_BUNDLE__/g, () => routes.stripStaticPrefix(main))
;
if (res.app.locals.viteServer) {
content = await res.app.locals.viteServer.transformIndexHtml(req.originalUrl, content);
if (res.app.locals.devServer) {
content = await res.app.locals.devServer.transformIndexHtml(req.originalUrl, content);
}
res.type("text/html");
res.send(content);
+1 -1
View File
@@ -21,7 +21,7 @@ declare global {
export interface Locals {
controller: Controller,
webBundle: { main: string, imports: Record<string, string> },
viteServer?: import("vite").ViteDevServer,
devServer?: import("vite").ViteDevServer,
staticRoot: string | null,
devPlugins?: Map<string, string>,
streams: Map<string, ProxyStream>,
+1 -1
View File
@@ -151,7 +151,7 @@ export class ControllerConfig extends classes.Config<ControllerConfigFields> {
optional: true,
validator: (value) => {
if (value) {
// This is unfortunately a limitiation of how the webpack build is set up right now.
// This is unfortunately a limitiation of how the web build is set up right now.
const pathname = new URL(value, "http://localhost/").pathname;
if (pathname !== "/static/") {
throw new Error(`Path component of static_url must be /static/ not ${pathname}.`);