Build the lobby plugin with Vite

Master replaced webpack with Vite and removed RequestError, port the
lobby plugin to both.
This commit is contained in:
Danielv123 committed 2026-10-29 20:55:59 +01:00
1 parent 00823262d5
commit bf3f4d445f
5 files changed
+12 -34

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
vite.config.js
dist/browser
+1 -1
View File
@@ -381,7 +381,7 @@ export class LobbyController {
startTransfer(player: string, instanceId: number, lobbyId?: number) {
const instance = this.controller.instances.get(instanceId);
if (!LobbyController.isRoutable(instance)) {
throw new lib.RequestError(`Instance ${instanceId} is not available`);
throw new lib.UnavailableError(`Instance ${instanceId} is not available`);
}
const ready = instance.status === "running";
const transfer: Transfer = {
+3 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@clusterio/plugin-lobby",
"version": "2.0.2",
"version": "2.0.3",
"description": "Clusterio plugin for a lobby server players pick the server to join from, and listing the cluster in the Factorio server browser",
"homepage": "https://github.com/clusterio/clusterio#readme",
"author": "Danielv123",
@@ -26,7 +26,7 @@
"type": "module",
"main": "dist/node/index.js",
"scripts": {
"prepare": "tsc --build && webpack-cli --mode production",
"prepare": "tsc --build && vite build",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
@@ -57,8 +57,6 @@
"@types/node": "catalog:",
"@types/react": "catalog:",
"typescript": "catalog:",
"webpack": "catalog:",
"webpack-cli": "catalog:",
"webpack-merge": "catalog:"
"vite": "catalog:"
}
}
+6
View File
@@ -0,0 +1,6 @@
import { defineConfig } from "vite";
import { clusterioPlugin } from "@clusterio/web_ui/vite.mjs";
export default defineConfig({
plugins: [clusterioPlugin()],
});
-28
View File
@@ -1,28 +0,0 @@
"use strict";
const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const common = require("@clusterio/web_ui/webpack.common");
module.exports = (env = {}, argv = {}) => merge(common(env, argv), {
context: __dirname,
entry: "./web/index.tsx",
output: {
path: path.resolve(__dirname, "dist", "web"),
},
plugins: [
new webpack.container.ModuleFederationPlugin({
name: "lobby",
library: { type: "var", name: "plugin_lobby" },
exposes: {
"./": "./index.ts",
"./package.json": "./package.json",
},
shared: {
"@clusterio/lib": { import: false },
"@clusterio/web_ui": { import: false },
},
}),
],
});