代码拉取完成,页面将自动刷新
"use strict";
import clear from "rollup-plugin-clear";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import fg from "fast-glob";
let targetArena = "";
if (process.argv[3] === "--config-") {
// we running dynamic mode
targetArena = process.argv[4] || "";
} else if (process.argv[3] === "--environment") {
targetArena = process.env.DEST;
}
function getOptions(arenaSrc) {
const outDir = arenaSrc.replace("src/", "dist/");
const options = {
input: `${arenaSrc}/main.ts`,
external: ["game", "game/prototypes", "game/constants", "game/utils", "game/path-finder", "arena", "game/visual"], // <-- suppresses the warning
output: {
dir: outDir,
format: "esm",
entryFileNames: "[name].mjs",
sourcemap: false,
preserveModules: true,
preserveModulesRoot: arenaSrc,
paths: path => {
// https://rollupjs.org/guide/en/#outputpaths
// TS requires that we use non-relative paths for these "ambient" modules
// The game requires relative paths, so prefix all game modules with "/" in the output bundle
if (path.startsWith("game") || path.startsWith("arena")) {
return "/" + path;
}
}
},
plugins: [
clear({ targets: targetArena === "" ? ["dist"] : [outDir] }), // If targeted build, only clear target sub-directory
resolve({ rootDir: "src" }),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" })
]
};
return options;
}
const arenas = fg.sync(`src/*arena_*${targetArena}*`, { onlyDirectories: true });
if (arenas.length === 0) {
throw new Error("No matching arenas found in src/. Exiting");
} else {
if (targetArena === "") {
console.log(`No arena targeted. Building all ${arenas.length} arenas.`);
} else {
console.log(`Buidling ${arenas.length} arena(s) for target "${targetArena}"`);
}
}
export default arenas.map(getOptions);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。