mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
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:
5 files changed
+12
-34
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
vite.config.js
|
||||||
|
dist/browser
|
||||||
@@ -381,7 +381,7 @@ export class LobbyController {
|
|||||||
startTransfer(player: string, instanceId: number, lobbyId?: number) {
|
startTransfer(player: string, instanceId: number, lobbyId?: number) {
|
||||||
const instance = this.controller.instances.get(instanceId);
|
const instance = this.controller.instances.get(instanceId);
|
||||||
if (!LobbyController.isRoutable(instance)) {
|
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 ready = instance.status === "running";
|
||||||
const transfer: Transfer = {
|
const transfer: Transfer = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@clusterio/plugin-lobby",
|
"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",
|
"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",
|
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||||
"author": "Danielv123",
|
"author": "Danielv123",
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/node/index.js",
|
"main": "dist/node/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "tsc --build && webpack-cli --mode production",
|
"prepare": "tsc --build && vite build",
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -57,8 +57,6 @@
|
|||||||
"@types/node": "catalog:",
|
"@types/node": "catalog:",
|
||||||
"@types/react": "catalog:",
|
"@types/react": "catalog:",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"webpack": "catalog:",
|
"vite": "catalog:"
|
||||||
"webpack-cli": "catalog:",
|
|
||||||
"webpack-merge": "catalog:"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { clusterioPlugin } from "@clusterio/web_ui/vite.mjs";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [clusterioPlugin()],
|
||||||
|
});
|
||||||
@@ -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 },
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user