85 lines
2.7 KiB
TypeScript
85 lines
2.7 KiB
TypeScript
import { resolve } from "node:path";
|
|
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
main: resolve(__dirname, "index.html"),
|
|
mapEditorPopup: resolve(__dirname, "map-editor-popup.html"),
|
|
mapHeightViewer: resolve(__dirname, "map-height-viewer.html"),
|
|
},
|
|
output: {
|
|
manualChunks(id) {
|
|
const normalizedId = id.replace(/\\/g, "/");
|
|
if (normalizedId.includes("node_modules")) {
|
|
if (normalizedId.includes("/pixi.js/")) {
|
|
return "vendor-pixi";
|
|
}
|
|
if (normalizedId.includes("/react/") || normalizedId.includes("/react-dom/")) {
|
|
return "vendor-react";
|
|
}
|
|
return "vendor-misc";
|
|
}
|
|
if (!normalizedId.includes("/src/mapEditorPopup/")) {
|
|
return undefined;
|
|
}
|
|
if (
|
|
normalizedId.includes("tileArtEditorWindowController")
|
|
|| normalizedId.includes("entityEditorWindowController")
|
|
|| normalizedId.includes("engineOverrideWindowController")
|
|
|| normalizedId.includes("statusLogWindowController")
|
|
|| normalizedId.includes("changelogSplashWindowController")
|
|
|| normalizedId.includes("toolWindowController")
|
|
|| normalizedId.includes("worldOverviewWindowController")
|
|
) {
|
|
return "map-editor-windows";
|
|
}
|
|
if (normalizedId.includes("pixiTileStageController")) {
|
|
return "map-editor-pixi";
|
|
}
|
|
if (
|
|
normalizedId.includes("renderController")
|
|
|| normalizedId.includes("overlayRenderer")
|
|
) {
|
|
return "map-editor-render";
|
|
}
|
|
if (
|
|
normalizedId.includes("interactionController")
|
|
|| normalizedId.includes("sidebarController")
|
|
|| normalizedId.includes("npcController")
|
|
|| normalizedId.includes("historyController")
|
|
|| normalizedId.includes("historyStateStore")
|
|
|| normalizedId.includes("importController")
|
|
|| normalizedId.includes("persistenceController")
|
|
|| normalizedId.includes("graphicsDocumentHelpers")
|
|
) {
|
|
return "map-editor-core";
|
|
}
|
|
return undefined;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: true,
|
|
port: 4170,
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://localhost:5180",
|
|
changeOrigin: true,
|
|
},
|
|
"/wiki": {
|
|
target: "http://localhost:5180",
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
preview: {
|
|
host: true,
|
|
port: 4170,
|
|
},
|
|
});
|